[report] minutes to first response for issues
This commit is contained in:
parent
57f35ddb4a
commit
f7e6ec0654
@ -64,6 +64,12 @@ def get_data():
|
|||||||
"label": _("Support Analytics"),
|
"label": _("Support Analytics"),
|
||||||
"icon": "icon-bar-chart"
|
"icon": "icon-bar-chart"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "report",
|
||||||
|
"name": "Minutes to First Response for Issues",
|
||||||
|
"doctype": "Issue",
|
||||||
|
"is_query_report": True
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
frappe.query_reports["Minutes to First Response for Issues"] = {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"fieldname":"from_date",
|
||||||
|
"label": __("From Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
'reqd': 1,
|
||||||
|
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"to_date",
|
||||||
|
"label": __("To Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
'reqd': 1,
|
||||||
|
"default":frappe.datetime.nowdate()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
get_chart_data: function(columns, result) {
|
||||||
|
console.log(result);
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
x: 'Date',
|
||||||
|
columns: [
|
||||||
|
['Date'].concat($.map(result, function(d) { return d[0]; })),
|
||||||
|
['Mins to first reponse'].concat($.map(result, function(d) { return d[1]; }))
|
||||||
|
]
|
||||||
|
},
|
||||||
|
chart_type: 'line'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"apply_user_permissions": 1,
|
||||||
|
"creation": "2016-06-14 17:44:26.034112",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"modified": "2016-06-14 17:50:28.082090",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Support",
|
||||||
|
"name": "Minutes to First Response for Issues",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"query": "select date(creation) as creation_date, avg(mins_to_first_response) from tabIssue where creation > '2016-05-01' group by date(creation) order by creation_date;",
|
||||||
|
"ref_doctype": "Issue",
|
||||||
|
"report_name": "Minutes to First Response for Issues",
|
||||||
|
"report_type": "Script Report"
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute(filters=None):
|
||||||
|
columns = [
|
||||||
|
{
|
||||||
|
'fieldname': 'creation_date',
|
||||||
|
'label': 'Date',
|
||||||
|
'fieldtype': 'Date'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fieldname': 'mins',
|
||||||
|
'label': 'Float',
|
||||||
|
'fieldtype': 'Mins to First Response'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
data = frappe.db.sql('''select date(creation) as creation_date,
|
||||||
|
avg(mins_to_first_response) as mins
|
||||||
|
from tabIssue where date(creation) between %s and %s
|
||||||
|
group by creation_date order by creation_date desc''', (filters.from_date, filters.to_date))
|
||||||
|
|
||||||
|
return columns, data
|
Loading…
x
Reference in New Issue
Block a user