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

@ -76,18 +76,14 @@ def execute():
row.db_update() row.db_update()
sla.db_update() sla.db_update()
frappe.delete_doc('DocType', 'Service Level')
# set issue status as Replied since Hold status is removed # set issue status as Replied since Hold status is removed
if frappe.db.exists('DocType', 'Issue'): if frappe.db.exists('DocType', 'Issue'):
issues_on_hold = frappe.db.sql(""" issues_on_hold = frappe.db.get_all('Issue', {'status': 'Hold'})
SELECT
name
FROM
`tabIssue`
WHERE
status = 'Hold'
""", as_dict=1)
issues = [entry.name for entry in issues_on_hold] issues = [entry.name for entry in issues_on_hold]
if not issues:
return
frappe.reload_doc('support', 'doctype', 'issue') frappe.reload_doc('support', 'doctype', 'issue')
frappe.db.sql(""" frappe.db.sql("""
@ -96,8 +92,8 @@ def execute():
SET SET
status='Replied' status='Replied'
WHERE WHERE
name in %(issues)s name IN %(issues)s
""", {'issues': issues}, debug=1) """, {'issues': issues})
def convert_to_seconds(value, unit): 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.service_level_agreement) {
if (frm.doc.status == "Replied") { if (frm.doc.status == "Replied") {
frm.dashboard.clear_headline(); 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( frm.dashboard.set_headline_alert(
'<div class="row">' + '<div class="row">' +
'<div class="col-xs-12">' + '<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>' +
'</div>' '</div>'
); );