|
@@ -197,8 +197,9 @@ class DRNClerkBot(Task): |
|
|
f_time = datetime.strptime(strp, match.group(2)) |
|
|
f_time = datetime.strptime(strp, match.group(2)) |
|
|
else: |
|
|
else: |
|
|
f_user, f_time = None, datetime.utcnow() |
|
|
f_user, f_time = None, datetime.utcnow() |
|
|
|
|
|
zero = datetime.min |
|
|
case = _Case(id_, title, status, self.STATUS_UNKNOWN, f_user, |
|
|
case = _Case(id_, title, status, self.STATUS_UNKNOWN, f_user, |
|
|
f_time, "", 0, "", 0, 0, False, False, 0, |
|
|
|
|
|
|
|
|
f_time, "", zero, "", zero, zero, False, False, 0, |
|
|
new=True) |
|
|
new=True) |
|
|
cases.append(case) |
|
|
cases.append(case) |
|
|
else: |
|
|
else: |
|
@@ -287,7 +288,8 @@ class DRNClerkBot(Task): |
|
|
if case.last_action != self.STATUS_NEEDASSIST: |
|
|
if case.last_action != self.STATUS_NEEDASSIST: |
|
|
case.status = self.STATUS_NEEDASSIST |
|
|
case.status = self.STATUS_NEEDASSIST |
|
|
timestamps = [timestamp for (editor, timestamp) in signatures] |
|
|
timestamps = [timestamp for (editor, timestamp) in signatures] |
|
|
if time() - max(timestamps) > 60 * 60 * 24 * 2: |
|
|
|
|
|
|
|
|
age = (datetime.utcnow() - max(timestamps)).total_seconds() |
|
|
|
|
|
if age > 60 * 60 * 24 * 2: |
|
|
if case.last_action != self.STATUS_STALE: |
|
|
if case.last_action != self.STATUS_STALE: |
|
|
case.status = self.STATUS_STALE |
|
|
case.status = self.STATUS_STALE |
|
|
return [] |
|
|
return [] |
|
@@ -307,7 +309,8 @@ class DRNClerkBot(Task): |
|
|
return [] |
|
|
return [] |
|
|
|
|
|
|
|
|
def clerk_review_case(self, case): |
|
|
def clerk_review_case(self, case): |
|
|
if time() - case.file_time > 60 * 60 * 24 * 7: |
|
|
|
|
|
|
|
|
age = (datetime.utcnow() - case.file_time).total_seconds() |
|
|
|
|
|
if age > 60 * 60 * 24 * 7: |
|
|
if not case.very_old_notified: |
|
|
if not case.very_old_notified: |
|
|
template = "{{subst:" + self.tl_notify_stale |
|
|
template = "{{subst:" + self.tl_notify_stale |
|
|
template += case.title.replace("|", "|") + "}}" |
|
|
template += case.title.replace("|", "|") + "}}" |
|
@@ -318,11 +321,11 @@ class DRNClerkBot(Task): |
|
|
|
|
|
|
|
|
def clerk_closed_case(self, case, signatures): |
|
|
def clerk_closed_case(self, case, signatures): |
|
|
if not case.close_time: |
|
|
if not case.close_time: |
|
|
case.close_time = time() |
|
|
|
|
|
|
|
|
case.close_time = datetime.utcnow() |
|
|
timestamps = [timestamp for (editor, timestamp) in signatures] |
|
|
timestamps = [timestamp for (editor, timestamp) in signatures] |
|
|
closed_long_ago = time() - case.close_time > 60 * 60 * 24 |
|
|
|
|
|
modified_long_ago = time() - max(timestamps) > 60 * 60 * 24 |
|
|
|
|
|
if closed_long_ago and modified_long_ago: |
|
|
|
|
|
|
|
|
close_age = (datetime.utcnow() - case.close_time).total_seconds() |
|
|
|
|
|
modify_age = (datetime.utcnow() - max(timestamps)).total_seconds() |
|
|
|
|
|
if closed_age > 60 * 60 * 24 and modify_age > 60 * 60 * 24: |
|
|
case.status = self.STATUS_ARCHIVE |
|
|
case.status = self.STATUS_ARCHIVE |
|
|
case.body = "{{" + self.tl_archive_top + "}}\n" + case.body |
|
|
case.body = "{{" + self.tl_archive_top + "}}\n" + case.body |
|
|
case.body += "\n{{" + self.tl_archive_bottom + "}}" |
|
|
case.body += "\n{{" + self.tl_archive_bottom + "}}" |
|
@@ -330,7 +333,8 @@ class DRNClerkBot(Task): |
|
|
case.body = re.sub(reg, "", case.body) |
|
|
case.body = re.sub(reg, "", case.body) |
|
|
|
|
|
|
|
|
def check_for_review(self, case): |
|
|
def check_for_review(self, case): |
|
|
if time() - case.file_time > 60 * 60 * 24 * 4: |
|
|
|
|
|
|
|
|
age = (datetime.utcnow() - case.file_time).total_seconds() |
|
|
|
|
|
if age > 60 * 60 * 24 * 4: |
|
|
if case.last_action != self.STATUS_REVIEW: |
|
|
if case.last_action != self.STATUS_REVIEW: |
|
|
case.status = self.STATUS_REVIEW |
|
|
case.status = self.STATUS_REVIEW |
|
|
|
|
|
|
|
|