Skip to content

Instantly share code, notes, and snippets.

@Londeren
Created October 6, 2019 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Londeren/eb01ad657f25f93ff3ede5fc1c30f009 to your computer and use it in GitHub Desktop.
Save Londeren/eb01ad657f25f93ff3ede5fc1c30f009 to your computer and use it in GitHub Desktop.
function IS_PASSED(arRange, currentDay, immunityCount) {
const IMMUNITY_SCORE = 1;
const NO_REPORT_SCORE = 0;
const range = arRange[0];
var immunities = immunityCount;
for (var day = 0; day < currentDay; day++) {
var score = Number(range[day]);
if (score === NO_REPORT_SCORE) {
return false;
}
if (score === IMMUNITY_SCORE) {
immunities = immunities - 1;
}
if (immunities < 0) {
return false;
}
}
return true;
//return JSON.stringify({range: range, currentDay: currentDay, immunityCount: immunityCount, isPassed: true, days: days});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment