coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Loïc on February 10, 2006, 11:12:18 AM

Title: Most popular picts ordered by click per day...
Post by: Loïc on February 10, 2006, 11:12:18 AM
Hi!

In order to not handicap new picts I would like to order most popular picts following the number of click per day instead of the total number of click... Is that mod already existing? Or anybody can help me?

Thanx,
Title: Re: Most popular picts ordered by click per day...
Post by: Loïc on February 16, 2006, 11:51:18 AM
up... :P
Title: Re: Most popular picts ordered by click per day...
Post by: Nibbler on February 16, 2006, 04:31:56 PM
Not posted afaik, you'd need to add in per day hit tracking to do this.
Title: Re: Most popular picts ordered by click per day...
Post by: Loïc on October 09, 2006, 12:15:43 PM
Here's what I tried, without succes:

I found:                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES'AND hits > 0 $META_ALBUM_SET $keyword ORDER BY hits DESC, filename  $limit";
and replace by: $now = time();

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES'AND hits > 0 $META_ALBUM_SET $keyword ORDER BY hits/($now-ctime) DESC, filename  $limit";


But all I got is the pict ordered by date...

Then I tried ORDER BY (hits/($now-ctime))
and
ORDER BY (hits*1/($now-ctime*1))
and
ORDER BY (hits*1/($now*1-ctime*1))
and finally
ORDER BY (hits*1/(".$now."-ctime*1))

with always the same result. I wonder if $now = time(); is correct.

Any idea???
Title: Re: Most popular picts ordered by click per day...
Post by: Loïc on October 12, 2006, 07:54:31 AM
OK, if someone cares about that, I found why it didn't work. The result was in click per second, and of course < to 0,01, so understood as 0,00. The solution is to multiply the result by 86400 to have the number of click per day...