fix: code clean-up

This commit is contained in:
Rucha Mahabal 2020-06-04 12:35:00 +05:30
parent 43d4397003
commit b3338a149b
2 changed files with 13 additions and 17 deletions

View File

@ -22,10 +22,10 @@ def execute():
if values:
holiday_list = values[0]
employee_group = values[1]
frappe.db.set_value('Service Level Agreement', entry.name, {
'holiday_list': holiday_list,
'employee_group': employee_group
})
frappe.db.set_value('Service Level Agreement', entry.name, {
'holiday_list': holiday_list,
'employee_group': employee_group
})
priority_dict = {}
@ -76,18 +76,14 @@ def execute():
row.db_update()
sla.db_update()
frappe.delete_doc('DocType', 'Service Level')
# set issue status as Replied since Hold status is removed
if frappe.db.exists('DocType', 'Issue'):
issues_on_hold = frappe.db.sql("""
SELECT
name
FROM
`tabIssue`
WHERE
status = 'Hold'
""", as_dict=1)
issues_on_hold = frappe.db.get_all('Issue', {'status': 'Hold'})
issues = [entry.name for entry in issues_on_hold]
if not issues:
return
frappe.reload_doc('support', 'doctype', 'issue')
frappe.db.sql("""
@ -96,8 +92,8 @@ def execute():
SET
status='Replied'
WHERE
name in %(issues)s
""", {'issues': issues}, debug=1)
name IN %(issues)s
""", {'issues': issues})
def convert_to_seconds(value, unit):

View File

@ -43,11 +43,11 @@ frappe.ui.form.on("Issue", {
if (frm.doc.service_level_agreement) {
if (frm.doc.status == "Replied") {
frm.dashboard.clear_headline();
let message = {"indicator": "orange", "msg": __("Replied {0}", [moment(frm.doc.on_hold_since).fromNow()])};
let message = {"indicator": "orange", "msg": __("Replied {0}", [frappe.datetime.comment_when(frm.doc.on_hold_since)])};
frm.dashboard.set_headline_alert(
'<div class="row">' +
'<div class="col-xs-12">' +
'<span class="indicator whitespace-nowrap '+ message.indicator +'"><span class="hidden-xs">'+ message.msg +'</span></span> ' +
'<span class="indicator whitespace-nowrap '+ message.indicator +'"><span>'+ message.msg +'</span></span> ' +
'</div>' +
'</div>'
);