Commit dacc1844 authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Edit function: format observations scatter plot

Replace if/else block with ternary operator
parent 57668697
......@@ -36,20 +36,18 @@ const formatSensorThingsApiResponseForScatterPlot = function (
obsArrayOne,
obsArrayTwo
) {
// When our observation arrays have DIFFERENT lengths
if (obsArrayOne.length !== obsArrayTwo.length) {
const [obsArrayOneFinal, obsArrayTwoFinal] =
checkForAndDeleteUniqueObservationsFromLargerArray(
obsArrayOne,
obsArrayTwo
);
return createCombinedObservationValues(obsArrayOneFinal, obsArrayTwoFinal);
}
// When our observation arrays already have SAME lengths
else {
return createCombinedObservationValues(obsArrayOne, obsArrayTwo);
}
// Check if our observation arrays have equal lengths,
// remove the unique observations, if necessary
const [obsArrayOneFinal, obsArrayTwoFinal] =
obsArrayOne.length !== obsArrayTwo.length
? checkForAndDeleteUniqueObservationsFromLargerArray(
obsArrayOne,
obsArrayTwo
)
: [obsArrayOne, obsArrayTwo];
// Create the combined observations array
return createCombinedObservationValues(obsArrayOneFinal, obsArrayTwoFinal);
};
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment