Hi Alex. I've been modding some things in nph-build and I think there is a bug in the sub build_update_counters
If a resource has multiple ratings, it didn't work correctly,
I changed the line
$update_rate = $LINKDB->prepare (qq! UPDATE Links Set Votes = Votes + ?, Rating = ((Rating*(Votes-1))+?)/(Votes-1+?) WHERE ID = ?!) ...
$update_rate = $LINKDB->prepare (qq! UPDATE Links Set Votes = Votes + ?, Rating = ((Rating*(Votes-?))+?)/Votes WHERE ID = ?!) ...
and $update_rate->execute ($votes,$rating,$votes,$key) if ($votes);
to
$update_rate->execute ($votes,$votes, $rating,$key) if ($votes);
It seems to work for multiple rates. The original code works okay if there is only 1 rating, but not if there are multiple ratings before it is built.
Kevin
If a resource has multiple ratings, it didn't work correctly,
I changed the line
$update_rate = $LINKDB->prepare (qq! UPDATE Links Set Votes = Votes + ?, Rating = ((Rating*(Votes-1))+?)/(Votes-1+?) WHERE ID = ?!) ...
$update_rate = $LINKDB->prepare (qq! UPDATE Links Set Votes = Votes + ?, Rating = ((Rating*(Votes-?))+?)/Votes WHERE ID = ?!) ...
and $update_rate->execute ($votes,$rating,$votes,$key) if ($votes);
to
$update_rate->execute ($votes,$votes, $rating,$key) if ($votes);
It seems to work for multiple rates. The original code works okay if there is only 1 rating, but not if there are multiple ratings before it is built.
Kevin