diff options
author | Yorhel <git@yorhel.nl> | 2020-11-28 19:36:09 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-11-28 19:36:14 +0100 |
commit | dd2762e6afab7cf33794c3d95bcfc8c9506702a1 (patch) | |
tree | ff3f2a0ffe7c964a65a719f14c3d25ab1d4fa930 /lib | |
parent | 8323430e739893d0899e92aa77097120861d1c43 (diff) |
AdvSearch: Add resolution autocomplete
Using a lazily loaded static list
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNWeb/Elm.pm | 4 | ||||
-rw-r--r-- | lib/VNWeb/Releases/Elm.pm | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/VNWeb/Elm.pm b/lib/VNWeb/Elm.pm index 4e9d435b..1dd2e93f 100644 --- a/lib/VNWeb/Elm.pm +++ b/lib/VNWeb/Elm.pm @@ -66,6 +66,10 @@ our %apis = ( lang => { type => 'array', values => {} }, platforms=> { type => 'array', values => {} }, } } ], + Resolutions => [ { aoh => { # Response to 'Resolutions' + resolution => {}, + count => { uint => 1 }, + } } ], BoardResult => [ { aoh => { # Response to 'Boards' btype => {}, iid => { required => 0, default => 0, id => 1 }, diff --git a/lib/VNWeb/Releases/Elm.pm b/lib/VNWeb/Releases/Elm.pm index f4ab8975..7f0578e4 100644 --- a/lib/VNWeb/Releases/Elm.pm +++ b/lib/VNWeb/Releases/Elm.pm @@ -10,4 +10,12 @@ elm_api Release => undef, { vid => { id => 1 } }, sub { elm_Releases releases_by_vn $data->{vid}; }; + +elm_api Resolutions => undef, {}, sub { + elm_Resolutions [ map +{ resolution => resolution($_), count => $_->{count} }, tuwf->dbAlli(q{ + SELECT reso_x, reso_y, count(*) AS count FROM releases WHERE NOT hidden AND NOT (reso_x = 0 AND reso_y = 0) + GROUP BY reso_x, reso_y ORDER BY count(*) DESC + })->@* ]; +}; + 1; |