attention: acknowledgements and unread questions involving a retired agent (active=0) are no longer listed; they can never be answered
This commit is contained in:
1 parent
99c83bfb75
commit
940cacc2d2
1 file changed
+5
-2
+5
-2
@@ -1069,9 +1069,12 @@ class Harbor(WorkMixin, ExtrasMixin, FlowMixin, LaunchMixin):
|
|||||||
overdue = {}
|
overdue = {}
|
||||||
closed = {f"item:{r['id']}" for r in self.conn.execute(
|
closed = {f"item:{r['id']}" for r in self.conn.execute(
|
||||||
"SELECT id FROM items WHERE state IN ('landed', 'rejected', 'withdrawn')")}
|
"SELECT id FROM items WHERE state IN ('landed', 'rejected', 'withdrawn')")}
|
||||||
|
retired = {r[0] for r in self.conn.execute("SELECT name FROM agents WHERE active=0")}
|
||||||
for r in self.pending_acks(overdue_minutes=ack_m):
|
for r in self.pending_acks(overdue_minutes=ack_m):
|
||||||
if r["agent"] != self.human and self.stopped(r["agent"]):
|
if r["agent"] != self.human and self.stopped(r["agent"]):
|
||||||
continue # a stopped agent cannot acknowledge; its stop shows already
|
continue # a stopped agent cannot acknowledge; its stop shows already
|
||||||
|
if r["agent"] in retired or r["sender"] in retired:
|
||||||
|
continue # a retired agent will never acknowledge, nor follow up
|
||||||
topic = self.conn.execute("SELECT t.topic FROM messages m JOIN threads t ON t.id=m.thread_id WHERE m.id=?",
|
topic = self.conn.execute("SELECT t.topic FROM messages m JOIN threads t ON t.id=m.thread_id WHERE m.id=?",
|
||||||
(r["id"],)).fetchone()
|
(r["id"],)).fetchone()
|
||||||
if topic and topic[0] in closed:
|
if topic and topic[0] in closed:
|
||||||
@@ -1113,8 +1116,8 @@ class Harbor(WorkMixin, ExtrasMixin, FlowMixin, LaunchMixin):
|
|||||||
"JOIN messages m ON m.id=d.message_id WHERE d.read_at IS NULL AND d.agent != ? AND m.origin != 'system' "
|
"JOIN messages m ON m.id=d.message_id WHERE d.read_at IS NULL AND d.agent != ? AND m.origin != 'system' "
|
||||||
"AND m.kind IN ('question', 'request') AND m.recipients != '[\"All\"]' AND m.created_at <= ? "
|
"AND m.kind IN ('question', 'request') AND m.recipients != '[\"All\"]' AND m.created_at <= ? "
|
||||||
"GROUP BY d.agent", (self.human, iso(utc(self.clock() - unread_after * 60)))):
|
"GROUP BY d.agent", (self.human, iso(utc(self.clock() - unread_after * 60)))):
|
||||||
if self.stopped(r["agent"]):
|
if self.stopped(r["agent"]) or r["agent"] in retired:
|
||||||
continue # a stopped agent cannot answer; its stop is shown already
|
continue # a stopped or retired agent cannot answer
|
||||||
ids = r["ids"].split(",")[:5]
|
ids = r["ids"].split(",")[:5]
|
||||||
out.append({"kind": "unread_questions", "agent": r["agent"], "minutes": self.minutes_since(r["first"]),
|
out.append({"kind": "unread_questions", "agent": r["agent"], "minutes": self.minutes_since(r["first"]),
|
||||||
"text": f"{r['agent']} has not read {r['n']} question(s) or request(s) sent to it: "
|
"text": f"{r['agent']} has not read {r['n']} question(s) or request(s) sent to it: "
|
||||||
|
|||||||
Reference in new issue
Block a user