showAlbumsUpdatedOverLastDays has different sort order than lastalb showAlbumsUpdatedOverLastDays has different sort order than lastalb
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

showAlbumsUpdatedOverLastDays has different sort order than lastalb

Started by jerx, January 26, 2007, 12:20:28 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

jerx

You can show the last updated albums in coppermine by putting lastalb into the breadcrump. It displays the recent added albums sorted according to creation date.
The showAlbumsUpdatedOverLastDays function of cpmfetch shows recent added albums, too, but they are sorted in alphabetical order.

In my opinion the sort order of coppermine is better, because it is much easier to keep track of new albums. The first album is the most recent and the last album is the oldest of the recent albums. This might be not important for one time users, but regular visitors will benefit. They won' t have to read the whole list in order to determine which albums have not been visited yet.

Is it difficult to change the sort order of that function?

vuud

Quote from: jerx on January 26, 2007, 12:20:28 AM
You can show the last updated albums in coppermine by putting lastalb into the breadcrump. It displays the recent added albums sorted according to creation date.
The showAlbumsUpdatedOverLastDays function of cpmfetch shows recent added albums, too, but they are sorted in alphabetical order.

In my opinion the sort order of coppermine is better, because it is much easier to keep track of new albums. The first album is the most recent and the last album is the oldest of the recent albums. This might be not important for one time users, but regular visitors will benefit. They won' t have to read the whole list in order to determine which albums have not been visited yet.

Is it difficult to change the sort order of that function?

That function is one of the first I added into cpmfetch, and is showing its age.  I've put off working on it because I am planning a rewrite of the output mechanism to support CSS or HTML or TEXT, etc...  And that function does some html.

Anyway,  I agree 100% with your comments and opinions on this...  I've just never thought about it or considered it until you brought it up.

That function uses getMediaAdded since in the cpmfetch_dao.php file... this one groups by category id, then album id, then sorts by category name and then picture mtime.

Hmmm, I am gonna have to run some queries to envision this...

But I agree that the output order should be by last added photo



Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

Your explanations helped a lot. Thank you! I think I have solved it.

The original function in cpmfetch_dao.php looks like this:
function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY c.name, p.mtime';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}


I changed it to:
function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY p.ctime DESC';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}


This groups the pictures by album id and then sorts by picture creation time, at least I think so. It seems to work. My albums are listed the same order I created them.

What I do not understand is, that the pictures are grouped by category first. I think if you only group by album id, you get the same results. Or does this speed up ordering and sorting?

vuud

Quote from: jerx on January 26, 2007, 05:18:26 AM
This groups the pictures by album id and then sorts by picture creation time, at least I think so. It seems to work. My albums are listed the same order I created them.

What I do not understand is, that the pictures are grouped by category first. I think if you only group by album id, you get the same results. Or does this speed up ordering and sorting?

It could be that another function is using this call...  I am not sure, perhaps the categories updated...

Its been awhile and its probably due for a rewrite anyway.

So you all set then?


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

Yes, everything is fine now. This can be marked as solved. Thanks for your help!