summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-10-31 15:20:56 +0100
committerYorhel <git@yorhel.nl>2010-10-31 15:20:56 +0100
commita30d60168a1c2b6494aaba4da8b025669ad6e131 (patch)
tree54dc21569aca61fabd6298e93f1d7898d167d778 /lib
parent69d3c18414c54b2251ed2bac765af320299abda2 (diff)
Remove duplicate votes when merging tags (fixes a 500)
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Tags.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index 2c1b287f..bfa56260 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -147,6 +147,10 @@ sub dbTagAdd {
sub dbTagMerge {
my($self, $id, @merge) = @_;
+ $self->dbExec(q|
+ DELETE FROM tags_vn tv
+ WHERE tag IN(!l)
+ AND EXISTS(SELECT 1 FROM tags_vn ti WHERE ti.tag = ? AND ti.uid = tv.uid AND ti.vid = tv.vid)|, \@merge, $id);
$self->dbExec('UPDATE tags_vn SET tag = ? WHERE tag IN(!l)', $id, \@merge);
$self->dbExec('UPDATE tags_aliases SET tag = ? WHERE tag IN(!l)', $id, \@merge);
$self->dbExec('INSERT INTO tags_aliases (tag, alias) VALUES (?, ?)', $id, $_->{name})