Commit e043c635 authored by Julien Schröter's avatar Julien Schröter

Skip adding reports which already exist

parent bba97800
Pipeline #2051 passed with stage
in 15 minutes and 3 seconds
...@@ -1493,7 +1493,7 @@ func (*MySQLDuelQuery) InsertReport(questionID uint32, text string) error { ...@@ -1493,7 +1493,7 @@ func (*MySQLDuelQuery) InsertReport(questionID uint32, text string) error {
return err return err
} }
_, err = db.Exec("INSERT INTO `report` (`question`, `test`) VALUES (?, ?)", questionID, text) _, err = db.Exec("REPLACE `report` (`question`, `test`) VALUES (?, ?)", questionID, text)
if err != nil { if err != nil {
if merr := err.(*mysql.MySQLError); merr.Number == 1452 { if merr := err.(*mysql.MySQLError); merr.Number == 1452 {
// Question does not exist // Question does not exist
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment