Skip to content

Commit

Permalink
removed unshift and using the standard assignment operators, as there…
Browse files Browse the repository at this point in the history
… are cases when the observation values could alredy have 2 values in the array
  • Loading branch information
RohitKandimalla committed Feb 9, 2024
1 parent 938b45a commit 44b3914
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ module.exports = class CalculatorHelpers {
}
if ('observation_values' in populationResults) {
// DENOM observation will be the first of 2 observations
populationResultsHandled.observation_values.unshift(0);
populationResultsHandled.observation_values[1] = populationResultsHandled.observation_values[0];
populationResultsHandled.observation_values[0] = 0;
}
}
if (populationResults.DENEX != null && !this.isValueZero('DENEX', populationResults) && populationResults.DENEX >= populationResults.DENOM) {
if ('observation_values' in populationResults) {
// DENOM observation will be the first of 2 observations
populationResultsHandled.observation_values.unshift(0);
populationResultsHandled.observation_values[1] = populationResultsHandled.observation_values[0];
populationResultsHandled.observation_values[0] = 0;
}
}
if (this.isValueZero('NUMER', populationResults)) {
Expand Down
6 changes: 4 additions & 2 deletions lib/helpers/calculator_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ module.exports = class CalculatorHelpers {
}
if ('observation_values' in populationResults) {
// DENOM observation will be the first of 2 observations
populationResultsHandled.observation_values.unshift(0);
populationResultsHandled.observation_values[1] = populationResultsHandled.observation_values[0];
populationResultsHandled.observation_values[0] = 0;
}
}
if (populationResults.DENEX != null && !this.isValueZero('DENEX', populationResults) && populationResults.DENEX >= populationResults.DENOM) {
if ('observation_values' in populationResults) {
// DENOM observation will be the first of 2 observations
populationResultsHandled.observation_values.unshift(0);
populationResultsHandled.observation_values[1] = populationResultsHandled.observation_values[0];
populationResultsHandled.observation_values[0] = 0;
}
}
if (this.isValueZero('NUMER', populationResults)) {
Expand Down

0 comments on commit 44b3914

Please sign in to comment.