Last active
August 29, 2015 14:08
-
-
Save sportebois/a6c419f8bf9af8fd0369 to your computer and use it in GitHub Desktop.
Parse a Jira plan view and extract the number of work days
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
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