fix: codacy

This commit is contained in:
prssanna 2019-11-12 21:21:12 +05:30
parent eae67eb0dd
commit f6b4fdef0c

View file

@ -368,28 +368,28 @@ frappe.ui.filter_utils = {
get_selected_value(field, condition) {
let val = field.get_value();
if(typeof val==='string') {
if (typeof val === 'string') {
val = strip(val);
}
if(condition == 'is' && !val) {
if (condition == 'is' && !val) {
val = field.df.options[0].value;
}
if(field.df.original_type == 'Check') {
if (field.df.original_type == 'Check') {
val = (val=='Yes' ? 1 :0);
}
if(condition.indexOf('like', 'not like')!==-1) {
if (condition.indexOf('like', 'not like') !== -1) {
// automatically append wildcards
if(val && !(val.startsWith('%') || val.endsWith('%'))) {
if (val && !(val.startsWith('%') || val.endsWith('%'))) {
val = '%' + val + '%';
}
} else if(in_list(["in", "not in"], condition)) {
if(val) {
} else if (in_list(["in", "not in"], condition)) {
if (val) {
val = val.split(',').map(v => strip(v));
}
} if(val === '%') {
} if (val === '%') {
val = "";
}