Created
March 3, 2020 23:29
-
-
Save iaindooley/398296f74e001383b2c66d8c3a2a9256 to your computer and use it in GitHub Desktop.
Only 2 cards assigned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onlyTwoCardsAssigned(notification) | |
{ | |
var notif = new Notification(notification); | |
var added = notif.addedMemberToCard(); | |
var existing = notif.board().cards().find(function(card) | |
{ | |
try | |
{ | |
card.member(added.name()); | |
return card; | |
} | |
catch(e) | |
{ | |
Notification.expectException(InvalidDataException,e); | |
return false; | |
} | |
}); | |
if(existing.length() > 2) | |
{ | |
added.card().removeMember(added); | |
notif.replyToMember("Only 2 cards per member"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment