Selaa lähdekoodia

[utils] added a method to sum an array of numbers

version-14
Anand Doshi 12 vuotta sitten
vanhempi
commit
fb413661c2
2 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. +4
    -0
      public/js/wn/misc/utils.js
  2. +2
    -2
      webnotes/model/controller.py

+ 4
- 0
public/js/wn/misc/utils.js Näytä tiedosto

@@ -168,4 +168,8 @@ wn.utils = {
}
return arr;
},
sum: function(list) {
return list.reduce(function(previous_value, current_value) { return flt(previous_value) + flt(current_value); });
},
};

+ 2
- 2
webnotes/model/controller.py Näytä tiedosto

@@ -26,7 +26,7 @@ from webnotes import msgprint, _
from webnotes.utils import flt, cint, cstr
from webnotes.model.meta import get_field_precision

error_coniditon_map = {
error_condition_map = {
"=": "!=",
"!=": "=",
"<": ">=",
@@ -71,7 +71,7 @@ class DocListController(object):
msg += _("Row") + (" # %d: " % doc.idx)
msg += _(self.meta.get_label(fieldname, parent=doc.doctype)) \
+ " " + error_coniditon_map.get(condition, "") + " " + cstr(val2)
+ " " + error_condition_map.get(condition, "") + " " + cstr(val2)
# raise passed exception or True
msgprint(msg, raise_exception=raise_exception or True)


Ladataan…
Peruuta
Tallenna