forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: lamama on October 04, 2004, 02:13:47 pm

Title: batch added pics appear all in lasthits ?
Post by: lamama on October 04, 2004, 02:13:47 pm
when I add uploaded pictures via the batch add-function, the new pics appear all at once in the lasthits-view.

bug or feature?
Title: Re: batch added pics appear all in lasthits ?
Post by: kegobeer on October 04, 2004, 04:21:08 pm
Do you mean they all have the same uploaded time?  That's correct, since all the pictures were processed at the same time.
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on October 05, 2004, 12:40:10 pm
no, I mean the fact that they are shown in the lasthits-view.

I would expect that only the last views from "real" users (or spiders or whatever...) appear there, not the "internal hits" of coppermine itself.
Title: Re: batch added pics appear all in lasthits ?
Post by: Nibbler on October 05, 2004, 12:45:10 pm
It would be whenever the info for that file was altered in the database, it is an automatic thing.
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on October 05, 2004, 10:55:46 pm
ok, that explains a lot :-)

but then it's no real "lasthits", right?
Title: Re: batch added pics appear all in lasthits ?
Post by: Joachim Müller on October 05, 2004, 11:55:00 pm
how is any software to "know" if the hit comes from a "real" surfer or a spider? I'm sorry, I don't get the point...

Joachim
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on October 06, 2004, 12:51:16 am
Its not real users vs. spiders but users/spiders vs. coppermine itself.

The point is, that the name "lasthits view" suggests that I get a list of what pictures users/spiders or any visitor from across the net has decided to watch.

I was surprised that also such pics that are added to the gallery via batch add appear in the "lasthits" view. It's something I had not expected - that's why I asked:

bug or feature?
I would suggest: bug. :-)
Title: Re: batch added pics appear all in lasthits ?
Post by: Tranz on October 06, 2004, 01:00:20 am
lamama, you must be more careful with your use of the word 'bug.'

Can you suggest a better way to calculate last hits?
Title: Re: batch added pics appear all in lasthits ?
Post by: kegobeer on October 06, 2004, 01:46:52 am
@lamama

This is by design, but you can easily modify the code.  Open up functions.inc.php and find

Code: [Select]
case 'lasthits': // Last viewed pictures
A few lines down you'll see this

Code: [Select]
$query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY mtime DESC $limit";
Change it to

Code: [Select]
$query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' and hits > 0 $ALBUM_SET ORDER BY mtime DESC $limit";
Now you'll only get pictures that have been hit at least once.

@The Dev team:

Should this be added to devel?
Title: Re: batch added pics appear all in lasthits ?
Post by: Tranz on October 06, 2004, 01:49:57 am
The drawback to using the alternative is that if you have albums that haven't been viewed, the last viewed meta album will show up saying no images to display.

It's for the same reason I can't use "most viewed" because some albums are new and have no or not enough hits.
Title: Re: batch added pics appear all in lasthits ?
Post by: kegobeer on October 06, 2004, 01:55:13 am
Quote
The drawback to using the alternative is that if you have albums that haven't been viewed, the last viewed meta album will show up saying no images to display.

If you have a new site with lasthits on the main page, it's correct to get No images to display.  If you upload a batch of images but haven't looked at them yet, it's also correct to get that message.  Or maybe I'm not on the same page with you, Tranz?
Title: Re: batch added pics appear all in lasthits ?
Post by: Tranz on October 06, 2004, 02:54:41 am
With the way things are now, if the images haven't been viewed, the 'last hit' time is the same as the uploaded time, so the last viewed meta album doesn't show "No images to display"
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on October 06, 2004, 04:08:19 am
lamama, you must be more careful with your use of the word 'bug.'

Can you suggest a better way to calculate last hits?

 ;D  Sorry, it's of course not a real "bug" ;-)  It just didn't behaved the way I expected.
If I watch the "last view" meta album I just want to know what other users have recently watched, but not if the upload script worked fine :-)


@TranzNDance: I don't understand why Images that never have been viewed need a "last hit" time?
Title: Re: batch added pics appear all in lasthits ?
Post by: kegobeer on October 06, 2004, 03:48:48 pm
I don't think there's any sense in having images that haven't been viewed yet showing up in the lasthits meta album - that's what the lastup meta album is for.
Title: Re: batch added pics appear all in lasthits ?
Post by: Tranz on October 06, 2004, 03:55:25 pm
How about this... instead of having a box saying "No images to display" if there are no photos that match a meta album's criteria, just don't make it show the box. Then, if we use the last hit meta album and there's an album with no hits, that box doesn't show up.
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on October 06, 2004, 06:49:44 pm
I'd have no problem with a "no images to display" box. If noone has visited a album and clicked some pics then it is so.

I just had a "problem" ;-) with pics that appear in that lasthits meta album but noone except coppermine itself ever "clicked" on them.  ::)
Title: Re: batch added pics appear all in lasthits ?
Post by: kegobeer on October 06, 2004, 07:18:14 pm
Have you applied my fix?  That takes care of images appearing in lasthits if they haven't been looked at yet.
Title: Re: batch added pics appear all in lasthits ?
Post by: lamama on November 10, 2004, 04:32:22 pm

Have you applied my fix?  That takes care of images appearing in lasthits if they haven't been looked at yet.

Yes, I finally applied it today.

Works fine! Many thanks!!

The actual code differs a bit from the line you posted:

original code (cpg 1.3.2.):
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY mtime DESC $limit");
modified code:
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' and hits > 0 $ALBUM_SET ORDER BY mtime DESC $limit");

(to be made in the "lasthits" section of  functions.inc.php as posted above.)