Skip to content

Instantly share code, notes, and snippets.

@RomiC
Last active August 29, 2015 13:56
Show Gist options
  • Save RomiC/8998420 to your computer and use it in GitHub Desktop.
Save RomiC/8998420 to your computer and use it in GitHub Desktop.
Sort subtasks in JIRA by their status
(function() {
var statusPriorites = {
"На тестирование": 1,
"Включить в деплой": 2,
"Открыт": 3,
"Ожидает допостановки": 4,
"В деплое": 5,
"Закрыт": 6
};
function SortIssues(i1, i2) {
/**
* Geting issues status priorites
* Unknown status getted the lowest priority
*/
var st1 = statusPriorites[$(".status img", i1).attr("alt")] || statusPriorites.length;
var st2 = statusPriorites[$(".status img", i2).attr("alt")] || statusPriorites.length;
return st1 < st2 ? -1 : (st1 > st2 ? 1 : 0);
};
function UpIssuePosition() {};
var issues = $(".issuerow");
if (issues.length) {
issues.sort(SortIssues);
$.each(issues, function() { console.log($(".status img", this).attr("alt"));});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment