summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Releases
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-03-04 12:00:13 +0100
committerYorhel <git@yorhel.nl>2021-03-04 12:06:17 +0100
commit7c9e24b57a5eaa1b026833ca11cba7a451cf8556 (patch)
tree0a4ace42210152f55da88424b75c7fa688120f61 /lib/VNWeb/Releases
parent5d54a844aba404e16280dcbd1ec3dffc9be4dfe1 (diff)
Releases: Store unknown minage as NULL + fix default for new entries
Fixes https://vndb.org/t950.905, which also reminded me that I can now finally store unknown as NULL rather than -1. The v2rw rewrite was preventing me from changing that earlier, handling NULLs was more annoying in the old v2 code.
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r--lib/VNWeb/Releases/Edit.pm4
-rw-r--r--lib/VNWeb/Releases/Lib.pm2
-rw-r--r--lib/VNWeb/Releases/Page.pm4
-rw-r--r--lib/VNWeb/Releases/VNTab.pm2
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm
index fe6de7b9..2bb09d61 100644
--- a/lib/VNWeb/Releases/Edit.pm
+++ b/lib/VNWeb/Releases/Edit.pm
@@ -21,7 +21,7 @@ my $FORM = {
gtin => { gtin => 1 },
catalog => { required => 0, default => '', maxlength => 50 },
released => { default => 99999999, min => 1, rdate => 1 },
- minage => { int => 1, enum => \%AGE_RATING },
+ minage => { required => 0, default => undef, int => 1, enum => \%AGE_RATING },
uncensored => { anybool => 1 },
reso_x => { uint => 1, range => [0,32767] },
reso_y => { uint => 1, range => [0,32767] },
@@ -136,7 +136,7 @@ elm_api ReleaseEdit => $FORM_OUT, $FORM_IN, sub {
$data->{doujin} = $data->{voiced} = $data->{ani_story} = $data->{ani_ero} = 0 if $data->{patch};
$data->{reso_x} = $data->{reso_y} = 0 if $data->{patch};
$data->{engine} = '' if $data->{patch};
- $data->{uncensored} = $data->{ani_ero} = 0 if $data->{minage} != 18;
+ $data->{uncensored} = $data->{ani_ero} = 0 if !defined $data->{minage} || $data->{minage} != 18;
$_->{qty} = $MEDIUM{$_->{medium}}{qty} ? $_->{qty}||1 : 0 for $data->{media}->@*;
$data->{notes} = bb_subst_links $data->{notes};
die "No VNs selected" if !$data->{vn}->@*;
diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm
index 3c97d326..e1340e03 100644
--- a/lib/VNWeb/Releases/Lib.pm
+++ b/lib/VNWeb/Releases/Lib.pm
@@ -104,7 +104,7 @@ sub release_row_ {
tr_ sub {
td_ class => 'tc1', sub { rdate_ $r->{released} };
- td_ class => 'tc2', $r->{minage} < 0 ? '' : minage $r->{minage};
+ td_ class => 'tc2', defined $r->{minage} ? minage $r->{minage} : '';
td_ class => 'tc3', sub {
abbr_ class => "icons $_", title => $PLATFORM{$_}, '' for grep $_ ne 'oth', $r->{platforms}->@*;
if($opt->{lang}) {
diff --git a/lib/VNWeb/Releases/Page.pm b/lib/VNWeb/Releases/Page.pm
index 936829e0..e2059e8f 100644
--- a/lib/VNWeb/Releases/Page.pm
+++ b/lib/VNWeb/Releases/Page.pm
@@ -155,12 +155,12 @@ sub _infotable_ {
tr_ sub {
td_ 'Age rating';
td_ minage $r->{minage};
- } if $r->{minage} >= 0;
+ } if defined $r->{minage};
tr_ sub {
td_ 'Censoring';
td_ $r->{uncensored} ? 'No optical censoring (e.g. mosaics)' : 'May include optical censoring (e.g. mosaics)';
- } if $r->{minage} == 18;
+ } if $r->{minage} && $r->{minage} == 18;
for my $t (qw|developer publisher|) {
my @prod = grep $_->{$t}, @{$r->{producers}};
diff --git a/lib/VNWeb/Releases/VNTab.pm b/lib/VNWeb/Releases/VNTab.pm
index e3da0609..cebaf7f6 100644
--- a/lib/VNWeb/Releases/VNTab.pm
+++ b/lib/VNWeb/Releases/VNTab.pm
@@ -121,7 +121,7 @@ my @rel_cols = (
sort_sql => 'r.minage %s, r.released %1$s, r.title %1$s',
button_string => 'Age rating',
default => 1,
- has_data => sub { $_[0]{minage} != -1 },
+ has_data => sub { defined $_[0]{minage} },
draw => sub { txt_ minage $_[0]{minage} },
}, { # Notes
id => 'not',