@@ -116,8 +116,7 @@ def set_rolling_responses(self, doc: Document):
116116 )
117117 elif doc .communication_status != self .get_default_priority ():
118118 current_time = now_datetime ()
119- customer_reply_time = self .get_last_customer_reply (doc ) or doc .last_responded_on
120- doc .last_response_time = self .calc_elapsed_time (customer_reply_time , current_time )
119+ doc .last_response_time = self .calc_elapsed_time (doc .last_responded_on , current_time )
121120 doc .last_responded_on = current_time
122121 is_failed = self .is_rolling_response_failed (doc )
123122 doc .append (
@@ -290,24 +289,6 @@ def calc_elapsed_time(self, start_time, end_time) -> float:
290289
291290 return total_seconds
292291
293- def get_last_customer_reply (self , doc : Document ):
294- """Get the communication_date of the last received (customer) message"""
295- result = frappe .get_all (
296- "Communication" ,
297- filters = {
298- "reference_doctype" : doc .doctype ,
299- "reference_name" : doc .name ,
300- "sent_or_received" : "Received" ,
301- "communication_type" : "Communication" ,
302- },
303- fields = ["communication_date" ],
304- order_by = "communication_date desc" ,
305- limit = 1 ,
306- )
307- if result :
308- return get_datetime (result [0 ].communication_date )
309- return None
310-
311292 def get_priorities (self ):
312293 """
313294 Return priorities related info as a dict. With `priority` as key
0 commit comments