Skip to content

Commit

Permalink
Revert "chore: ticket: move first response logic"
Browse files Browse the repository at this point in the history
This reverts commit f1b2775.
  • Loading branch information
ssiyad committed Oct 13, 2023
1 parent f148d76 commit 31fe610
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def before_validate(self):
self.set_contact()
self.set_customer()
self.set_priority()
self.set_first_responded_on()
self.set_feedback_values()
self.apply_escalation_rule()
self.set_sla()
Expand Down Expand Up @@ -229,6 +230,10 @@ def set_priority(self):
or DEFAULT_TICKET_PRIORITY
)

def set_first_responded_on(self):
if self.status == "Replied" and not self.first_responded_on:
self.first_responded_on = frappe.utils.now_datetime()

def set_feedback_values(self):
if not self.feedback:
return
Expand Down Expand Up @@ -720,13 +725,9 @@ def apply_sla(self):
# is an external dependency. Refer `communication.py` of Frappe framework for more.
# Since this is called from communication itself, `c` is the communication doc.
def on_communication_update(self, c):
# If communication is outgoing, then it is a reply from agent.
if c.sent_or_received == "Sent":
# If communication is outgoing, then it is a reply from agent.
self.status = "Replied"
# Set first response time. This must be set only once
self.first_responded_on = (
self.first_responded_on or frappe.utils.now_datetime()
)
# Fetch description from communication if not set already. This might not be needed
# anymore as a communication is created when a ticket is created.
self.description = self.description or c.content
Expand Down

0 comments on commit 31fe610

Please sign in to comment.