i have a conditional of IF'S
based in the result of fetch..
if ((result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Updated" && result[0][1].without_any_update === "Already Updated" && result[0][1].status_update_in_2018 === "Not Updated") && (result[0][2].without_any_update === "No Update" && result[0][2].status_update_in_2018 === "Not Updated")) {
resultado = {
updateIn2018: result[0][0].in_2018,
olderThan2018: result[0][1].in_2018,
notUpdate: result[0][2].in_2018,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018) + parseInt(result[0][2].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Updated" && result[0][1].without_any_update === "Already Updated" && result[0][1].status_update_in_2018 === "Not Updated") {
resultado = {
updateIn2018: result[0][0].in_2018,
olderThan2018: result[0][1].in_2018,
notUpdate: 0,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Updated" && result[0][1].without_any_update === "No Update" && result[0][1].status_update_in_2018 === "Not Updated") {
resultado = {
updateIn2018: result[0][0].in_2018,
olderThan2018: 0,
notUpdate: result[0][1].in_2018,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Not Updated" && result[0][1].without_any_update === "No Update" && result[0][1].status_update_in_2018 === "Not Updated") {
resultado = {
updateIn2018: 0,
olderThan2018: result[0][0].in_2018,
notUpdate: result[0][1].in_2018,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018)
}
} else if (result[0][0].without_any_update === "No Update" && result[0][0].status_update_in_2018 === "Not Updated" && result[0][1].without_any_update === "Already Updated" && result[0][1].status_update_in_2018 === "Updated") {
resultado = {
updateIn2018: result[0][0].in_2018,
olderThan2018: 0,
notUpdate: result[0][1].in_2018,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Not Updated" && result[0][1].without_any_update === "Already Updated" && result[0][1].status_update_in_2018 === "Updated") {
resultado = {
updateIn2018: result[0][0].in_2018,
olderThan2018: result[0][1].in_2018,
notUpdate: 0,
total: parseInt(result[0][0].in_2018) + parseInt(result[0][1].in_2018)
}
} else if (result[0][0].without_any_update === "No Update" && result[0][0].status_update_in_2018 === "Not Updated") {
resultado = {
updateIn2018: 0,
olderThan2018: 0,
notUpdate: result[0][0].in_2018,
total: parseInt(result[0][0].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Not Updated") {
resultado = {
updateIn2018: 0,
olderThan2018: result[0][0].in_2018,
notUpdate: 0,
total: parseInt(result[0][0].in_2018)
}
} else if (result[0][0].without_any_update === "Already Updated" && result[0][0].status_update_in_2018 === "Updated") {
resultado = {
updateIn2018: parseInt(result[0][0].in_2018),
olderThan2018: 0,
notUpdate: 0,
total: parseInt(result[0][0].in_2018)
}
}
But it gives a unexpected result, in the first
and the last
conditional.
The first
is basically: If there is an object with three
attributes make something.
And the last
is: If there is an object ONLY with an attribute make other.
But if the fetch came with ONLY attribute it go to first
conditional and is wrong, it was to go to last
conditional.
Somebody could help me? Please? I dont know what i making wrong.
Aucun commentaire:
Enregistrer un commentaire