Created
March 24, 2020 12:56
-
-
Save iaindooley/d3741a615c172551a5cfb6a14c71a31f to your computer and use it in GitHub Desktop.
Sort lists by labels and description
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 sortListByLabel(notification) | |
{ | |
var moved = new Notification(notification).movedCard(); | |
moved.currentList().sort(function(card1,card2) | |
{ | |
var ret = 0; | |
try | |
{ | |
if(card1.labels().first().name().toLowerCase() > card2.labels().first().name().toLowerCase()) | |
ret = 1; | |
else if(card1.labels().first().name().toLowerCase() < card2.labels().first().name().toLowerCase()) | |
ret = -1; | |
} | |
catch(e) | |
{ | |
Notification.expectException(InvalidDataException,e); | |
} | |
return ret; | |
}); | |
} | |
function sortListByDescription(notification) | |
{ | |
var moved = new Notification(notification).movedCard(); | |
moved.currentList().sort(function(card1,card2) | |
{ | |
var ret = 0; | |
if(card1.description().toLowerCase() > card2.description().toLowerCase()) | |
ret = 1; | |
else if(card1.description().toLowerCase() < card2.description().toLowerCase()) | |
ret = -1; | |
return ret; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment