Commit bba97800 authored by Julien Schröter's avatar Julien Schröter Committed by Julien Schröter

Return empty explanation if question has no explanation

parent b2442d5f
Pipeline #2044 passed with stage
in 13 minutes and 53 seconds
...@@ -1075,7 +1075,10 @@ func (m *MySQLDuelQuery) getExplanation(db dbhandler.DBAccess, questionID uint32 ...@@ -1075,7 +1075,10 @@ func (m *MySQLDuelQuery) getExplanation(db dbhandler.DBAccess, questionID uint32
res := db.QueryRow(queryString, questionID) res := db.QueryRow(queryString, questionID)
if errScan := res.Scan(&text, &image); errScan != nil { if errScan := res.Scan(&text, &image); errScan == sql.ErrNoRows {
m.InsertReport(questionID, "AUTO-REPORT: Question has no explanation.")
return new(schemas.ExplanationSchema), nil
} else if errScan != nil {
return nil, fmt.Errorf("failed to query explanation for question %d. %s SQL: %s", questionID, errScan.Error(), queryString) return nil, fmt.Errorf("failed to query explanation for question %d. %s SQL: %s", questionID, errScan.Error(), queryString)
} }
......
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