coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: die2nite on July 09, 2007, 01:57:50 AM

Title: Most Viewed, but not random
Post by: die2nite on July 09, 2007, 01:57:50 AM
Is there anyway to get the Most Viewed images, but not have them be randomly displayed and instead from highest viewed to lowest viewed?

Thanks,
Title: Re: Most Viewed, but not random
Post by: vuud on July 09, 2007, 04:29:21 AM
Quote from: die2nite on July 09, 2007, 01:57:50 AM
Is there anyway to get the Most Viewed images, but not have them be randomly displayed and instead from highest viewed to lowest viewed?

Thanks,

That may be in the next version... That is a tough one to work out.  Not programmatically but theory wise?

Lets say you have 100 pictures or varying views.  From which subset should the random be picked?  See the problem?
Title: Re: Most Viewed, but not random
Post by: die2nite on July 09, 2007, 05:24:20 AM
Well let's say you have the following file set with the views following it.

File 1 - 7 Views
File 2 - 11 Views
File 3 - 7 Views
File 4 - 9 Views
File 5 - 2 Views

Then it should display like this:

File 2
File 4
File 1
File 3
File 5

But since Files 1 and 3 have the same views it could do one of the following to choose which one to show first: make it random for just those two, so positions three and four in the list would be random, or just put the first one the script encounters in the database in position three and the other one in position four.  Personally I would prefer the second way, just so users wouldn't be confused about why they keep interchanging. 

The reason I'm asking for this is begin I'm putting a section on my site for the "Most Popular Files" and I want them to be measured by the views and in descending order so users will immediately know what is the most popular file.

Thanks for the quick response vuud
Title: Re: Most Viewed, but not random
Post by: vuud on July 09, 2007, 10:57:51 PM
Quote from: die2nite on July 09, 2007, 05:24:20 AM
Well let's say you have the following file set with the views following it.

File 1 - 7 Views
File 2 - 11 Views
File 3 - 7 Views
File 4 - 9 Views
File 5 - 2 Views

Then it should display like this:

File 2
File 4
File 1
File 3
File 5

But since Files 1 and 3 have the same views it could do one of the following to choose which one to show first: make it random for just those two, so positions three and four in the list would be random, or just put the first one the script encounters in the database in position three and the other one in position four.  Personally I would prefer the second way, just so users wouldn't be confused about why they keep interchanging. 

The reason I'm asking for this is begin I'm putting a section on my site for the "Most Popular Files" and I want them to be measured by the views and in descending order so users will immediately know what is the most popular file.

Thanks for the quick response vuud

Ah sorry, I read it quick and thought you wanted the random.

Yeah, I think that is actually in the works.  Thing is what to do if they are all 0 views?  I plan on letting the query run and have mysql do whatever it does in that instance :D

Check the next dev release when it comes out.

Title: Re: Most Viewed, but not random
Post by: die2nite on July 09, 2007, 11:51:48 PM
Awesome, thanks vuud!