Skip to content

Instantly share code, notes, and snippets.

@sportebois
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sportebois/a6c419f8bf9af8fd0369 to your computer and use it in GitHub Desktop.
Save sportebois/a6c419f8bf9af8fd0369 to your computer and use it in GitHub Desktop.
Parse a Jira plan view and extract the number of work days
javascript:alert("nb de jours: " + _.reduce($(".js-issue:not(.ghx-filtered) span.aui-badge").map(function(ind, item) {
console.log(item.innerText);
var res = item.innerText.match(/(\d+)?w/i);
var nbWeeks = res? 144000*parseInt(res[1]) : 0;
res = item.innerText.match(/(\d+)?d/i);
var nbDays = res? 28800*parseInt(res[1]) : 0;
res = item.innerText.match(/(\d+)?h/i);
var nbHours = res? 3600*parseInt(res[1]) : 0;
res = item.innerText.match(/(\d+)?m/i);
var nbMins = res? 60*parseInt(res[1]) : 0;
res = item.innerText.match(/(\d+)?s/i);
var nbSecs = res? 1*parseInt(res[1]) : 0;
return (nbWeeks+nbDays+nbHours+nbMins+nbSecs);
}), function(prevSecs, itemSecs, ind, arr) { return prevSecs+itemSecs;},0) / (8*3600));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment