Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

"Newest_Link" field in Category Table no longer updated properly?

Quote Reply
"Newest_Link" field in Category Table no longer updated properly?
Hi,

While continuing to search for a fix to the Days_Old plugin problem ( http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=283195 ) I noticed the "Newest_Link" field was no longer updated properly (or like 2.2.1) in the Category Table.

When adding a new link the "Newest_Link" field is updated with the date it was added to the category. The problem arises when that new link is then copied to other categories. The "Newest_Link" field is no longer updated in the Category Table when links are copied to other cateories.

For Example:

Links SQL 2.2.1...

Category => Newest_Link
-Cat1 => 2005-6-18
-Cat2 => 2005-6-18
-Cat3 => 2005-6-18

Links SQL 3.0.3...

Category => Newest_Link
-Cat1 => 2005-6-18
-Cat2 => 2005-4-25
-Cat3 => 2005-4-25

I use Days_Old to display category folders similar to that at hotscripts.com . Without LinksSQL updating the "Newest_Link" field like it once did in 2.2.1 I'll have to elliminate the feature completely since I add sites to multiply categories.

Hopefully that made sense! Thank for any help on this...

Last edited by:

Jonze: Jun 19, 2005, 6:59 PM
Quote Reply
Re: [Jonze] "Newest_Link" field in Category Table no longer updated properly? In reply to
It's a bug in the code. Here's a patch that should correct that issue.

Code:
--- admin/Links/Table/Links.pm 9 Jun 2005 18:50:03 -0000 1.20
+++ admin/Links/Table/Links.pm 23 Jun 2005 02:12:33 -0000 1.21
@@ -316,7 +316,8 @@
}

# If this link is now validated this link, let's update category counters and new flags.
- if (not $was_counted and $now_counted) {
+# It also needs to be updated if a link has been added to new categories.
+ if ((not $was_counted and $now_counted) or @new_cats) {
foreach my $cat (keys %cat_ids) {
my @cats = ($cat, @{$Category->parents($cat)});
my $cond = GT::SQL::Condition->new(ID => '=', \@cats);

Adrian
Quote Reply
Re: [brewt] "Newest_Link" field in Category Table no longer updated properly? In reply to
Thanks so much for the quick patch Adrian!

Just finished testing and the fix works great. Great job as always.