Fix a bug where ratings were allowed to be set with less than 10 votes. Fixes bug #11294
This helps fix people trying to game the system.
This commit is contained in:
parent
5153d82327
commit
d1e6f30493
5 changed files with 253 additions and 94 deletions
|
|
@ -608,9 +608,11 @@ sub setRatings {
|
|||
my $mean = $sum / ($count || 1);
|
||||
my $median = $db->quickScalar("select rating $sql order by rating limit $half,1",[$self->getId,$category]);
|
||||
|
||||
$db->write("replace into MatrixListing_ratingSummary
|
||||
(listingId, category, meanValue, medianValue, countValue, assetId)
|
||||
values (?,?,?,?,?,?)",[$self->getId,$category,$mean,$median,$count,$matrixId]);
|
||||
if ($count >= 10) {
|
||||
$db->write("replace into MatrixListing_ratingSummary
|
||||
(listingId, category, meanValue, medianValue, countValue, assetId)
|
||||
values (?,?,?,?,?,?)",[$self->getId,$category,$mean,$median,$count,$matrixId]);
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue