Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [SandraR] Inaccurate links count: Edit Log

Here is the list of edits for this post
Re: [SandraR] Inaccurate links count
Hi,

This is the global used to calculate the value for grand total:


sub _grand_total {
# -------------------------------------------------------------------
# Calculates the total in three queries as it can be significantly faster
# on large db's.
#
my $total = $DB->table('CatLinks')->count - $DB->table('Links')->count({ isValidated => 'No' });
if ($CFG->{payment}->{enabled}) {
$total -= $DB->table('Links')->count(
GT::SQL::Condition->new(
ExpiryDate => '<' => time,
isValidated => '=' => 'Yes'
)
);
}
return $total;
}

This means that it uses the CatLinks table and the Links table. I assume that when you deleted the categories you removed the entries in the CatLinks table? As far as I can see this counts links that are in multiple categories multiple times - could this be the problem? If so, you could just use a new global that counts the number of links in the Links table:

sub {
my $total;
if ($CFG->{payment}->{enabled}) {
$total = $DB->table('Links')->count(
GT::SQL::Condition->new(
'ExpiryDate' => '>=' => time,
'isValidated' => '=' => 'Yes'
)
);
} else {
$total = $DB->table('Links')->count(
isValidated => 'Yes'
); }
return $total;
}

Last edited by:

afinlr: Oct 14, 2004, 2:59 PM

Edit Log: