From 8fc1dfa6775d3421b90a7fc7044ac34f4d19d1bc Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <erdnaxeli@gmail.com> Date: Mon, 19 Aug 2013 19:50:15 +0200 Subject: [PATCH] insert a tag already in context changes it in real tag --- lib/commands/tag.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm index 5487b1b..9f4f552 100644 --- a/lib/commands/tag.pm +++ b/lib/commands/tag.pm @@ -34,7 +34,10 @@ sub addTag return if ($stopwords_en->{lc $tag} or $stopwords_fr->{lc $tag}); - my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) VALUES (?, ?, ?)'); + my $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) + VALUES (?, ?, ?) + ON DUPLICATE KEY + UPDATE context = 0'); $log->error("Couldn't prepare querie; aborting") unless (defined $sth); $sth->execute($id, $tag, ($context) ? 1 : 0) -- GitLab