summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-04-08 11:40:38 +0200
committerYorhel <git@yorhel.nl>2018-04-08 11:40:43 +0200
commit0f408b8379901cd964452cda7053d0482adf161a (patch)
tree0196fef0a830a4f52b2484cc8ae4fb9b6a15a403
parent3f857868b3b7da47f9f0bcf2bef51450332c3ae1 (diff)
Char edit: Display linked VNs even if VN & releases have been deleted
There's still a glitch that, when a character is linked to a deleted release, the release selection will not show up in the form. But that's much easier to work around.
-rw-r--r--lib/VNDB/Handler/Releases.pm21
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 2e058fb6..073ea82d 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -626,25 +626,16 @@ sub relxml {
);
return $self->resNotFound if $f->{_err};
- my $list = $self->dbReleaseGet(vid => $f->{v}, results => 100, what => 'vn');
- my %vns = map +($_,0), @{$f->{v}};
- for my $r (@$list) {
- for my $v (@{$r->{vn}}) {
- next if !exists $vns{$v->{vid}};
- $vns{$v->{vid}} = [ $v ] if !$vns{$v->{vid}};
- push @{$vns{$v->{vid}}}, $r;
- }
- }
- !$vns{$_} && delete $vns{$_} for(keys %vns);
+ my $vns = $self->dbVNGet(id => $f->{v}, order => 'title', results => 100);
+ my $rel = $self->dbReleaseGet(vid => $f->{v}, results => 100, what => 'vn');
+
$self->resHeader('Content-type' => 'text/xml; charset=UTF-8');
xml;
tag 'vns';
- for (sort { $a->[0]{title} cmp $b->[0]{title} } values %vns) {
- next if !$_;
- my $v = shift @$_;
- tag 'vn', id => $v->{vid}, title => $v->{title};
+ for my $v (@$vns) {
+ tag 'vn', id => $v->{id}, title => $v->{title};
tag 'release', id => $_->{id}, lang => join(',', @{$_->{languages}}), $_->{title}
- for (@$_);
+ for (grep (grep $_->{vid} == $v->{id}, @{$_->{vn}}), @$rel);
end;
}
end;