fix: reset issue metrics on Reopen and Split

This commit is contained in:
Rucha Mahabal 2020-05-06 11:42:43 +05:30
parent a2a1e257ae
commit fc4c795661

View File

@ -71,6 +71,7 @@ class Issue(Document):
if self.status=="Open" and status !="Open":
# if no date, it should be set as None and not a blank string "", as per mysql strict config
self.resolution_date = None
self.reset_issue_metrics()
def update_agreement_status(self):
if self.service_level_agreement and self.agreement_fulfilled == "Ongoing":
@ -131,6 +132,7 @@ class Issue(Document):
replicated_issue.response_by_variance = None
replicated_issue.resolution_by = None
replicated_issue.resolution_by_variance = None
replicated_issue.reset_issue_metrics()
frappe.get_doc(replicated_issue).insert()
@ -224,6 +226,12 @@ class Issue(Document):
self.agreement_fulfilled = "Ongoing"
self.save()
def reset_issue_metrics(self):
self.db_set('resolution_time', 0)
self.db_set('user_operational_time', 0)
self.db_set('avg_response_time',0)
def get_expected_time_for(parameter, service_level, start_date_time):
current_date_time = start_date_time
expected_time = current_date_time