From 36b5a5f7901ce12999fb65e4d7568d3d727e7083 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 28 Jan 2019 23:25:30 -0500 Subject: [PATCH] afc_statistics: Fix query for getting accepting reviewer info. --- tasks/afc_statistics.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/afc_statistics.py b/tasks/afc_statistics.py index ee0ebbb..dfd6de7 100644 --- a/tasks/afc_statistics.py +++ b/tasks/afc_statistics.py @@ -612,9 +612,12 @@ class AFCStatistics(Task): def get_accepted(self, pageid, content=None): """Return (acceptor, accept_ts, accept_revid) for the given page.""" - query = """SELECT rev_user_text, rev_timestamp, rev_id FROM revision - WHERE rev_comment LIKE "% moved page [[%]] to [[%]]%" - AND rev_page = ? ORDER BY rev_timestamp DESC LIMIT 1""" + query = """SELECT rev_user_text, rev_timestamp, rev_id + FROM revision + LEFT JOIN comment ON rev_comment_id = comment_id + WHERE rev_page = ? + AND comment_text LIKE "% moved page [[%]] to [[%]]%" + ORDER BY rev_timestamp DESC LIMIT 1""" result = self.site.sql_query(query, (pageid,)) try: a_user, a_time, a_id = list(result)[0]