diff options
author | Yorhel <git@yorhel.nl> | 2022-05-27 11:18:42 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2022-05-27 11:18:42 +0200 |
commit | f12ed769a92dc55c7e54e682528f99bdd1ce14ff (patch) | |
tree | 7b2d44b054f7cb59f5548423490cbf3d24cd77db | |
parent | c59c01c36057c476d041e22bba88115b6df7ba2b (diff) |
VN::Page: Add link to /lengthvotes if there is an uncounted vote
-rw-r--r-- | lib/VNWeb/VN/Page.pm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/VNWeb/VN/Page.pm b/lib/VNWeb/VN/Page.pm index da5f639f..b77c4d05 100644 --- a/lib/VNWeb/VN/Page.pm +++ b/lib/VNWeb/VN/Page.pm @@ -185,10 +185,16 @@ sub infobox_length_ { txt_ ' from '; a_ href => "/$v->{id}/lengthvotes", sprintf '%d vote%s', $v->{c_lengthnum}, $v->{c_length}==1?'':'s'; txt_ ')'; - } elsif($v->{length}) { - txt_ "$VN_LENGTH{$v->{length}}{txt} ($VN_LENGTH{$v->{length}}{time})"; } else { - txt_ 'Unknown'; + my $uncounted = tuwf->dbVali('SELECT count(*) FROM vn_length_votes WHERE vid =', \$v->{id}, 'AND NOT private AND speed IS NULL'); + txt_ $VN_LENGTH{$v->{length}}{txt}; + if ($v->{length} || $uncounted) { + lit_ ' ('; + txt_ $VN_LENGTH{$v->{length}}{time} if $v->{length}; + lit_ ', ' if $v->{length} && $uncounted; + a_ href => "/$v->{id}/lengthvotes", sprintf '%d uncounted vote%s', $uncounted, $uncounted == 1 ? '' : 's' if $uncounted; + lit_ ')'; + } } if (auth->permLengthvote) { elm_ VNLengthVote => $VNWeb::VN::Length::LENGTHVOTE, { |