Skip to content

Instantly share code, notes, and snippets.

@backnotprop
Created October 27, 2017 17:32
Show Gist options
  • Save backnotprop/8c153462ae0a81c312e12b31fcac8784 to your computer and use it in GitHub Desktop.
Save backnotprop/8c153462ae0a81c312e12b31fcac8784 to your computer and use it in GitHub Desktop.
/**
* Elimination Stage 2
* - removes all preferences in a list who can not be possibly matched
*/
function _eliminateStage() {
_.forIn(_DB, (person,id) => {
let keepLast = _.findIndex(person.choices, function(p) { return p.id == person.acceptedReceivedID; });
for(let i = keepLast + 1; i < person.choices.length; i++) {
// each the rejected and rejecter can remove each other from choices list
eliminateChoices(person, _DB[person.choices[i].id]);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment