summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-06-04 12:17:02 +0200
committerYorhel <git@yorhel.nl>2021-06-04 12:17:02 +0200
commit876cea23dd1063fcc327031d00105637a82fb55a (patch)
tree1889c309c9ba1fac12e9fc39b81fa334e3402710 /lib
parent7ff0f4b68b402155b92097f7a53e52a5d51ff3db (diff)
Fix use of c_(rating|popularity) in API and AdvSearch filters
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/API.pm4
-rw-r--r--lib/VNWeb/AdvSearch.pm4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index b64319a1..1d0ac5cf 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -455,8 +455,8 @@ my %GET_VN = (
stats => {
select => 'v.c_popularity, v.c_rating, v.c_votecount as votecount',
proc => sub {
- $_[0]{popularity} = 1 * sprintf '%.2f', 100*(delete $_[0]{c_popularity} or 0);
- $_[0]{rating} = 1 * sprintf '%.2f', 0.1*(delete $_[0]{c_rating} or 0);
+ $_[0]{popularity} = 1 * sprintf '%.2f', (delete $_[0]{c_popularity} or 0)/100;
+ $_[0]{rating} = 1 * sprintf '%.2f', (delete $_[0]{c_rating} or 0)/100;
$_[0]{votecount} *= 1;
},
},
diff --git a/lib/VNWeb/AdvSearch.pm b/lib/VNWeb/AdvSearch.pm
index b1c58062..9acf9761 100644
--- a/lib/VNWeb/AdvSearch.pm
+++ b/lib/VNWeb/AdvSearch.pm
@@ -314,8 +314,8 @@ f v => 4 => 'platform', { enum => \%PLATFORM }, '=' => sub { sql 'v.c_platform
f v => 6 => 'developer-id',{ vndbid => 'p' }, '=' => sub { sql 'v.c_developers && ARRAY', \$_, '::vndbid[]' };
f v => 5 => 'length', { uint => 1, enum => \%VN_LENGTH }, '=' => sub { sql 'v.length =', \$_ };
f v => 7 => 'released', { fuzzyrdate => 1 }, sql => sub { sql 'v.c_released', $_[0], \($_ == 1 ? strftime('%Y%m%d', gmtime) : $_) };
-f v => 9 => 'popularity',{ uint => 1, range => [ 0, 100] }, sql => sub { sql 'v.c_popularity', $_[0], \($_/100) };
-f v => 10 => 'rating', { uint => 1, range => [10, 100] }, sql => sub { sql 'v.c_rating', $_[0], \$_ };
+f v => 9 => 'popularity',{ uint => 1, range => [ 0, 100] }, sql => sub { sql 'v.c_popularity', $_[0], \($_*100) };
+f v => 10 => 'rating', { uint => 1, range => [10, 100] }, sql => sub { sql 'v.c_rating', $_[0], \($_*10) };
f v => 11 => 'vote-count',{ uint => 1, range => [ 0,1<<30] }, sql => sub { sql 'v.c_votecount', $_[0], \$_ };
f v => 61 => 'has-description', { uint => 1, range => [1,1] }, '=' => sub { 'v."desc" <> \'\'' };
f v => 62 => 'has-anime', { uint => 1, range => [1,1] }, '=' => sub { 'EXISTS(SELECT 1 FROM vn_anime va WHERE va.id = v.id)' };