Browse Source

ref(js): utilise parseInt plutôt que Number

pull/54/head
François Poulain 10 months ago
parent
commit
5f644cd30d
  1. 4
      assets/js/ponderated.js

4
assets/js/ponderated.js

@ -16,10 +16,10 @@ $(() => { @@ -16,10 +16,10 @@ $(() => {
const error = wrapper.parent().find('.invalid-feedback:contains(mandats disponibles)');
const inputs = wrapper.find('input');
$(inputs).on('change', () => {
const availableInt = Number(available[0].textContent);
const availableInt = parseInt(available[0].textContent, 10);
const affected = inputs.map((idx, elem) => elem.value).get()
.reduce((pv, cv) => {
return pv + (Number(cv) || 0);
return pv + (parseInt(cv, 10) || 0);
}, 0);
if (availableInt - affected >= 0) {
remaining[0].textContent = availableInt - affected;

Loading…
Cancel
Save
Map all the world