fix: handle issue metrics on Reopen and Close
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index dfe0647..131e1cb 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -54,7 +54,7 @@
   "attachment",
   "via_customer_portal",
   "resolution_time",
-  "user_operational_time"
+  "user_resolution_time"
  ],
  "fields": [
   {
@@ -374,27 +374,33 @@
   {
    "bold": 1,
    "fieldname": "avg_response_time",
-   "fieldtype": "Data",
+   "fieldtype": "Duration",
    "label": "Average Response Time",
-   "read_only": 1
-  },
-  {
-   "fieldname": "user_operational_time",
-   "fieldtype": "Data",
-   "label": "User Operational Time",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   },
   {
    "fieldname": "resolution_time",
-   "fieldtype": "Data",
+   "fieldtype": "Duration",
    "label": "Resolution Time",
-   "read_only": 1
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
+  },
+  {
+   "fieldname": "user_resolution_time",
+   "fieldtype": "Duration",
+   "label": "User Resolution Time",
+   "read_only": 1,
+   "show_days": 1,
+   "show_seconds": 1
   }
  ],
  "icon": "fa fa-ticket",
  "idx": 7,
  "links": [],
- "modified": "2020-04-28 23:42:28.576580",
+ "modified": "2020-05-06 12:28:58.093654",
  "modified_by": "Administrator",
  "module": "Support",
  "name": "Issue",
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index f2ee754..4fb2d8a 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -63,10 +63,10 @@
 			self.resolution_date = frappe.flags.current_time or now_datetime()
 			if frappe.db.get_value("Issue", self.name, "agreement_fulfilled") == "Ongoing":
 				set_service_level_agreement_variance(issue=self.name)
-				set_average_response_time(issue=self)
-				set_resolution_time(issue=self)
-				set_user_operational_time(issue=self)
 				self.update_agreement_status()
+			set_average_response_time(issue=self)
+			set_resolution_time(issue=self)
+			set_user_resolution_time(issue=self)
 
 		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
@@ -227,9 +227,9 @@
 		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)
+		self.db_set('resolution_time', None)
+		self.db_set('user_resolution_time', None)
+		self.db_set('avg_response_time', None)
 
 
 def get_expected_time_for(parameter, service_level, start_date_time):
@@ -337,7 +337,7 @@
 	issue.db_set('resolution_time', resolution_time)
 
 
-def set_user_operational_time(issue):
+def set_user_resolution_time(issue):
 	# total time taken by a user to close the issue apart from wait_time
 	communications = frappe.get_list("Communication", filters={
 			"reference_doctype": issue.doctype,
@@ -356,8 +356,8 @@
 
 	total_pending_time = sum(pending_time)
 	resolution_time_in_secs = time_diff_in_seconds(now_datetime(), issue.creation)
-	user_operational_time = resolution_time_in_secs - total_pending_time
-	issue.db_set('user_operational_time', user_operational_time)
+	user_resolution_time = resolution_time_in_secs - total_pending_time
+	issue.db_set('user_resolution_time', user_resolution_time)
 
 
 def get_list_context(context=None):