fix: codacy

This commit is contained in:
Himanshu Warekar 2019-05-06 01:35:11 +05:30
parent 785f98efd9
commit aa0eaab3df
3 changed files with 30 additions and 24 deletions

View File

@ -33,7 +33,7 @@ frappe.ui.form.on("Issue", {
frm.call('change_sla_priority', {
"priority": frm.doc.priority
}).then(() => {
frm.refresh()
frm.refresh();
});
}
},
@ -116,6 +116,5 @@ function get_time_left(timestamp) {
if (diff_display == '00:00') {
indicator = "red";
}
return {"diff_display": diff_display,
"indicator": indicator};
return {"diff_display": diff_display, "indicator": indicator};
}

View File

@ -11,12 +11,17 @@ frappe.ui.form.on('Service Level Agreement', {
name: frm.doc.service_level
},
callback: function(data){
for (var i in data.message.priorities){
let count = Math.max(data.message.priorities.length, data.message.support_and_resolution.length);
let i = 0;
while (i < count){
if (data.message.priorities[i]) {
frm.add_child("priorities", data.message.priorities[i]);
}
for (var i in data.message.support_and_resolution){
if (data.message.support_and_resolution[i]) {
frm.add_child("support_and_resolution", data.message.support_and_resolution[i]);
}
i++;
}
frm.refresh();
}
});

View File

@ -41,21 +41,23 @@ def check_agreement_status():
@frappe.whitelist()
def get_active_service_level_agreement_for(customer, priority):
agreement = frappe.db.sql("""
select `tabService Level Agreement`.name, `tabService Level Agreement`.service_level,
agreement = frappe.db.sql("""select `tabService Level Agreement`.name, `tabService Level Agreement`.service_level,
`tabService Level Agreement`.holiday_list
from `tabService Level Agreement`
inner join `tabService Level Priority`
on `tabService Level Agreement`.name=`tabService Level Priority`.parent where
(
`tabService Level Agreement`.customer='{0}' and
`tabService Level Agreement`.customer='%(customer)s' and
`tabService Level Agreement`.agreement_status='Active' and
`tabService Level Priority`.priority='{1}'
`tabService Level Priority`.priority='%(priority)s'
) or
(
`tabService Level Agreement`.default_service_level_agreement='1'
)
limit 1
""".format(customer, priority), as_dict=True)
limit 1""",
{
"customer": customer,
"priority": priority
}, as_dict=True)
return agreement[0] if agreement else None