summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Tags.pm2
-rw-r--r--lib/VNDB/Handler/Tags.pm11
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index 478cd91c..2c1b287f 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -104,7 +104,7 @@ sub dbTagTree {
JOIN tags t ON !s
WHERE tt.lvl > 0
AND t.state = 2
- ) SELECT id, parent, name, c_vns FROM tagtree ORDER BY name|, $lvl,
+ ) SELECT DISTINCT id, parent, name, c_vns FROM tagtree ORDER BY name|, $lvl,
$id ? {'id = ?' => $id} : {'NOT EXISTS(SELECT 1 FROM tags_parents WHERE tag = id)' => 1, 'state = 2' => 1},
!$back ? ('tp.parent = tt.id', 't.id = tp.tag') : ('tp.tag = tt.id', 't.id = tp.parent')
);
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index edd73496..612b603d 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -73,8 +73,8 @@ sub tagpage {
h1 $title;
p;
- my @p = @{$t->{parents}};
- for my $p (_parenttags(@p)) {
+ my @p = _parenttags(@{$t->{parents}});
+ for my $p (@p ? @p : []) {
a href => '/g', mt '_tagp_indexlink';
for (reverse @$p) {
txt ' > ';
@@ -82,10 +82,6 @@ sub tagpage {
}
txt " > $t->{name}\n";
}
- if(!@p) {
- a href => '/g', mt '_tagp_indexlink';
- txt " > $t->{name}\n";
- }
end;
if($t->{description}) {
@@ -127,8 +123,7 @@ sub _parenttags {
my @r;
for my $t (@_) {
for (@{$t->{'sub'}}) {
- my @p = _parenttags($_);
- push @r, [ $t, @p?@{$p[0]}:() ];
+ push @r, [ $t, @$_ ] for _parenttags($_);
}
push @r, [$t] if !@{$t->{'sub'}};
}