Update SecretSanta.js
This commit is contained in:
parent
936238ee77
commit
ef1f017671
1 changed files with 3 additions and 0 deletions
|
@ -62,6 +62,9 @@ SecretSanta.prototype.generate = function () {
|
||||||
|
|
||||||
var name = findNextGifter();
|
var name = findNextGifter();
|
||||||
|
|
||||||
|
if ( candidatePairings[ name ].length === 0 )
|
||||||
|
throw new Error('We haven\'t been able to find a match for ' + name + '! Press "Generate" to try again and, if it still doesn\'t work, try removing some exclusions from your rules. Sorry for the inconvenience!');
|
||||||
|
|
||||||
var pairing = _.sample( candidatePairings[ name ] );
|
var pairing = _.sample( candidatePairings[ name ] );
|
||||||
delete candidatePairings[ name ];
|
delete candidatePairings[ name ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue