瀏覽代碼

Be smarter about re-opened cases.

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
1588e047c7
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. +9
    -6
      earwigbot/tasks/drn_clerkbot.py

+ 9
- 6
earwigbot/tasks/drn_clerkbot.py 查看文件

@@ -172,9 +172,9 @@ class DRNClerkBot(Task):
def read_database(self, conn):
"""Return a list of _Cases from the database."""
cases = []
query = "SELECT * FROM cases WHERE case_status != ?"
query = "SELECT * FROM cases"
with conn.cursor() as cursor:
cursor.execute(query, (self.STATUS_UNKNOWN,))
cursor.execute(query)
for row in cursor:
case = _Case(*row)
cases.append(case)
@@ -234,11 +234,14 @@ class DRNClerkBot(Task):
case.title = title
case.body, case.old = body, old

for case in cases:
for case in cases[:]:
if case.body is None:
case.status = self.STATUS_UNKNOWN
log = u"Dropped case {0} because it is no longer on the page ('{1}')"
self.logger.debug(log.format(case.id, case.title))
if case.original_status == self.STATUS_UNKNOWN:
cases.remove(case) # Ignore archived case
else:
case.status = self.STATUS_UNKNOWN
log = u"Dropped case {0} because it is no longer on the page ('{1}')"
self.logger.debug(log.format(case.id, case.title))

self.logger.debug("Done reading cases from the noticeboard page")



Loading…
取消
儲存