fix: codacy
diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index d31ae4a..a19b372 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -33,7 +33,7 @@
frm.call('change_sla_priority', {
"priority": frm.doc.priority
}).then(() => {
- frm.refresh()
+ frm.refresh();
});
}
},
@@ -116,6 +116,5 @@
if (diff_display == '00:00') {
indicator = "red";
}
- return {"diff_display": diff_display,
- "indicator": indicator};
+ return {"diff_display": diff_display, "indicator": indicator};
}
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.js b/erpnext/support/doctype/service_level_agreement/service_level_agreement.js
index 2da4b03..4f334f2 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.js
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.js
@@ -11,11 +11,16 @@
name: frm.doc.service_level
},
callback: function(data){
- for (var i in data.message.priorities){
- frm.add_child("priorities", data.message.priorities[i]);
- }
- for (var i in data.message.support_and_resolution){
- frm.add_child("support_and_resolution", data.message.support_and_resolution[i]);
+ 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]);
+ }
+ if (data.message.support_and_resolution[i]) {
+ frm.add_child("support_and_resolution", data.message.support_and_resolution[i]);
+ }
+ i++;
}
frm.refresh();
}
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index 4fca708..ea869ee 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -41,21 +41,23 @@
@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,
- `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`.agreement_status='Active' and
- `tabService Level Priority`.priority='{1}'
- ) or
- (
- `tabService Level Agreement`.default_service_level_agreement='1'
- )
- limit 1
- """.format(customer, priority), as_dict=True)
+ 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='%(customer)s' and
+ `tabService Level Agreement`.agreement_status='Active' and
+ `tabService Level Priority`.priority='%(priority)s'
+ ) or
+ (
+ `tabService Level Agreement`.default_service_level_agreement='1'
+ )
+ limit 1""",
+ {
+ "customer": customer,
+ "priority": priority
+ }, as_dict=True)
return agreement[0] if agreement else None
\ No newline at end of file