Browse Source

updating situation for automatic Pluviometer

master
analuizaff 3 years ago
parent
commit
aa9a939e11
  1. 64
      src/app/components/AssembleModalObject.js

64
src/app/components/AssembleModalObject.js

@ -146,41 +146,39 @@ const AssembleModalObject = async (response, name, userId, formId) => {
//(waiting for issue #16) user = r[0].formsanswersuserinformer; //(waiting for issue #16) user = r[0].formsanswersuserinformer;
if (name == "automaticPluviometer") { if (name == "automaticPluviometer") {
(situation = "PLUVIÔMETRO"),
r[0].array_to_json.forEach(function (f) {
var day = { label: null, values: [] };
if (f.fieldname == "medicao") {
var measureDate = moment(
f.fieldsanswersdtfilling,
"YYYY-MM-DDTHH:mm:ss"
).format("DD/MM");
situation = "PLUVIÔMETRO";
r[0].array_to_json.forEach(function (f) {
var day = { label: null, values: [] };
if (f.fieldname == "medicao") {
var measureDate = moment(
f.fieldsanswersdtfilling,
"YYYY-MM-DDTHH:mm:ss"
).format("DD/MM");
if (verifymeasureDates(data.labels, measureDate, day)) {
day.values.push(
f.fieldsanswersvalue ? parseFloat(f.fieldsanswersvalue) : null
);
day.label = measureDate;
datapluv.push(day);
} else {
datapluv.forEach((d) => {
if (d.label == measureDate) {
d.values.push(
f.fieldsanswersvalue
? parseFloat(f.fieldsanswersvalue)
: null
);
}
});
}
if (verifymeasureDates(data.labels, measureDate, day)) {
day.values.push(
f.fieldsanswersvalue ? parseFloat(f.fieldsanswersvalue) : null
);
day.label = measureDate;
datapluv.push(day);
} else {
datapluv.forEach((d) => {
if (d.label == measureDate) {
d.values.push(
f.fieldsanswersvalue ? parseFloat(f.fieldsanswersvalue) : null
);
}
});
} }
}
if (f.fieldname == "siglarede") {
institution = f.fieldsanswersvalue;
}
if (f.fieldname == "nome") {
address = f.fieldsanswersvalue;
}
});
if (f.fieldname == "siglarede") {
institution = f.fieldsanswersvalue;
}
if (f.fieldname == "nome") {
address = f.fieldsanswersvalue;
}
});
if (datapluv) { if (datapluv) {
datapluv.sort(function (dataPluv, dataPluvB) { datapluv.sort(function (dataPluv, dataPluvB) {
@ -188,7 +186,7 @@ const AssembleModalObject = async (response, name, userId, formId) => {
}); });
} }
// console.log(datapluv);
// console.log(datapluv);
} else if (name == "pluviometer") { } else if (name == "pluviometer") {
situation = "PLUVIÔMETRO"; situation = "PLUVIÔMETRO";
r[r.length - 1].array_to_json.forEach(function (f) { r[r.length - 1].array_to_json.forEach(function (f) {

Loading…
Cancel
Save