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

[BUG REPORT] Build Changed not working with new reviews/ratings...

Quote Reply
[BUG REPORT] Build Changed not working with new reviews/ratings...
Hi. It seems that when you do a build changed, ratings and reviews do not get edited on the static pages. I've noticed this on 2 sites that I have been working on recently. #

Can anyone else confirm this?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
Hi Andy,

In order to fix it, you have to modify two files, Links/User/Rate.pm and Links/User/Review.pm

In Rate.pm, replace:

Code:


$db->update ( { Votes => $rec->{Votes}, Rating => $rec->{Rating} }, { ID => $rec->{ID} });
with:

Code:
$rec->{'CatLinks.CategoryID'} = $DB->table('CatLinks')->select( { LinkID => $rec->{ID} })->fetchall_list();
$db->modify($rec);


In Review.pm, below:

Code:


# Add the review.
my $added_id = $db->add ( $input );
$input->{ReviewID} = $added_id;
if (! $added_id) {
my $error = "<ul><li>" . join ("<li>", $db->error) . "</ul>";
return { error => "<ul>$error</ul>"};
}
Add:


Code:
$rec->{'CatLinks.CategoryID'} = $DB->table('CatLinks')->select( { LinkID => $rec->{ID} })->fetchall_list();
$DB->table("Links")->modify($rec) or die "$GT::SQL::error";


Virginia
Quote Reply
Re: [Virginia] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
Hi Virginia. I tried your fix, but it still doesn't seem to be applying these changes when doing a 'Build Changed' Unsure

Any ideas?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Virginia] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
BTW, this is on 2.1.2.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
Hi Andy,

Please apply the following changes to the changes you made last time.

In Rate.pm, replace:
Code:
$rec->{'CatLinks.CategoryID'} = $DB->table('CatLinks')->select( { LinkID => $rec->{ID} })->fetchall_list();


with:

Code:
my @cids = $DB->table('CatLinks')->select('CategoryID', { LinkID => $rec->{ID} })->fetchall_list;
$rec->{'CatLinks.CategoryID'} = \@cids;


In Review.pm, replace:

Code:
$rec->{'CatLinks.CategoryID'} = $DB->table('CatLinks')->select( { LinkID => $rec->{ID} })->fetchall_list();


with:

Code:


my @cids = $DB->table('CatLinks')->select('CategoryID', { LinkID => $rec->{ID} })->fetchall_list;
$rec->{'CatLinks.CategoryID'} = \@cids;
Hope it helps,

Virginia
Quote Reply
Re: [Virginia] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
Great.. works fine now :) Just to re-iterate the changes, for anyone trying to apply this fix now;

In Rate.pm, replace:


Code:
$db->update ( { Votes => $rec->{Votes}, Rating => $rec->{Rating} }, { ID => $rec->{ID} });

with:

Code:

my @cids = $DB->table('CatLinks')->select('CategoryID', { LinkID => $rec->{ID} })->fetchall_list;
$rec->{'CatLinks.CategoryID'} = \@cids;
$db->modify($rec);

In Review.pm, below:

Code:

# Add the review.
my $added_id = $db->add ( $input );
$input->{ReviewID} = $added_id;
if (! $added_id) {
my $error = "<ul><li>" . join ("<li>", $db->error) . "</ul>";
return { error => "<ul>$error</ul>"};
}

Add:

Code:

my @cids = $DB->table('CatLinks')->select('CategoryID', { LinkID => $rec->{ID} })->fetchall_list;
$rec->{'CatLinks.CategoryID'} = \@cids;
$DB->table("Links")->modify($rec) or die "$GT::SQL::error";

Thanks Virginia :) May be worth making a post in the official bug fix forum, just so its easier for people to find this fix :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Virginia] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
Mmm... maybe not. Detailed pages are being changed now, but category pages still don't get updated :/

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Virginia] [BUG REPORT] Build Changed not working with new reviews/ratings... In reply to
I managed to get this working.In Rate.pm, after;

Code:
$db->modify($rec);

I added;

Code:
my $cat_update = $DB->table('Category');
$cat_update->update( { Has_Changed_Links => "Yes" }, { ID => $cids[0] } ) || die $GT::SQL::error;

I would imagine this is a bit of a dirty fix, but it seems to be working ok at the moment.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!