diff options
-rw-r--r-- | data/docs/11 | 3 | ||||
-rw-r--r-- | lib/Multi/API.pm | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/data/docs/11 b/data/docs/11 index 723bc686..af0c718a 100644 --- a/data/docs/11 +++ b/data/docs/11 @@ -527,7 +527,7 @@ however still required.<br /> "width", integer, width of the full-size screenshot<br /> </tr> </table> -<p>Sorting is possible on the 'id', 'title' and 'released' fields.</p><br /> +<p>Sorting is possible on the following fields: id, title, released, popularity, rating, votecount.</p><br /> <p>'get vn' accepts the following filter expressions:</p> <table style="margin: 5px 2%; width: 95%"> @@ -1495,6 +1495,7 @@ however still required.<br /> <li>Added support for TLS</li> <li>Added "screens" flag and member to "get vn"</li> <li>Added "vns" flag and member to "get character"</li> + <li>Allow sorting "get vn" on popularity, rating and votecount</li> </ul> <b>2.23</b> <ul> diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm index b73ec58c..2b35d0d3 100644 --- a/lib/Multi/API.pm +++ b/lib/Multi/API.pm @@ -381,6 +381,9 @@ my %GET_VN = ( id => 'v.id %s', title => 'v.title %s', released => 'v.c_released %s', + popularity => 'v.c_popularity %s NULLS LAST', + rating => 'v.c_rating %s NULLS LAST', + votecount => 'v.c_votecount %s', }, flags => { basic => { @@ -785,7 +788,7 @@ my %GET_CHARACTER = ( fetch => [[ 'id', 'SELECT id, vid, rid, spoil, role FROM chars_vns WHERE id IN(%s)', sub { my($n, $r) = @_; for my $i (@$n) { - $i->{vns} = [ map [ $_->{vid}*1, $_->{rid}*1, $_->{spoil}*1, $_->{role} ], grep $i->{id} == $_->{id}, @$r ]; + $i->{vns} = [ map [ $_->{vid}*1, ($_->{rid}||0)*1, $_->{spoil}*1, $_->{role} ], grep $i->{id} == $_->{id}, @$r ]; } }, ]], |