Skip to content

Instantly share code, notes, and snippets.

@singularityhacker
Last active August 25, 2021 18:56
Show Gist options
  • Select an option

  • Save singularityhacker/22fa28489f70240f2f74ae4019df6866 to your computer and use it in GitHub Desktop.

Select an option

Save singularityhacker/22fa28489f70240f2f74ae4019df6866 to your computer and use it in GitHub Desktop.
A script (bookmarklet) to extract the relevant metrics from Jira sprint reports
var OI = 0;
var AI = 0;
var OP = 0;
var AP = 0;
var OS = 0;
var AS = 0;
var D_OI = 0;
var D_AI = 0;
var D_OS = 0;
var D_AS = 0;
var D_AP = 0;
var D_OP = 0;
var CE = 0;
var UE = 0;
console.log($("#ghx-items-trigger").text());
$("table").eq(1).find("td:first-child").each(function() {
if($(this).text().includes("*")){
AI += 1;
D_AI += 1;
var pts = $(this).next().next().next().next().next().text();
var issueType = $(this).next().next().text();
if(issueType == "User Story"){
AS += 1;
D_AS += 1;
}
if(pts.includes("→")){
var changedVal = parseInt($(this).next().next().next().next().next().find(".ghx-current-value").text());
CE += 1;
if(changedVal != "-"){
AP += parseInt(changedVal);
D_AP += parseInt(changedVal);
} else {
UE += 1;
};
} else {
var unChangedVal = $(this).next().next().next().next().next().text();
if(unChangedVal != "-"){
AP += parseInt(unChangedVal);
D_AP += parseInt(unChangedVal);
} else {
UE += 1;
};
}
} else {
OI += 1;
D_OI += 1;
var pts = $(this).next().next().next().next().next().text();
var issueType = $(this).next().next().text();
if(issueType == "User Story"){
OS += 1;
D_OS += 1;
}
if(pts.includes("→")){
var changedVal = $(this).next().next().next().next().next().find(".ghx-current-value").text();
CE += 1;
OP += parseInt(changedVal);
D_OP += parseInt(changedVal);
} else {
var unChangedVal = $(this).next().next().next().next().next().text();
OP += parseInt(unChangedVal);
D_OP += parseInt(unChangedVal);
}
}
});
$("table").eq(2).find("td:first-child").each(function() {
if($(this).text().includes("*")){
AI += 1;
var pts = $(this).next().next().next().next().next().text();
var issueType = $(this).next().next().text();
if(issueType == "User Story"){
AS += 1;
}
if(pts.includes("→")){
var changedVal = parseInt($(this).next().next().next().next().next().find(".ghx-current-value").text());
CE += 1;
if(changedVal != "-"){
AP += parseInt(changedVal);
} else {
UE += 1;
};
} else {
var unChangedVal = $(this).next().next().next().next().next().text();
if(unChangedVal != "-"){
AP += parseInt(unChangedVal);
} else {
UE += 1;
};
}
} else {
OI += 1;
var pts = $(this).next().next().next().next().next().text();
var issueType = $(this).next().next().text();
if(issueType == "User Story"){
OS += 1;
}
if(pts.includes("→")){
var changedVal = $(this).next().next().next().next().next().find(".ghx-current-value").text();
CE += 1;
OP += parseInt(changedVal);
} else {
var unChangedVal = $(this).next().next().next().next().next().text();
OP += parseInt(unChangedVal);
}
}
});
console.log("5. Original Items: " + OI );
console.log("6. Done Original Items: " + D_OI );
console.log("7. Added Items: " + AI );
console.log("8. Done Added Items: " + D_AI );
console.log("9. Original Stories: " + OS );
console.log("10. Done Original Stories: " + D_OS );
console.log("11. Added Stories: " + AS );
console.log("12. Done Added Stories: " + D_AS );
console.log("13. Original Points: " + OP );
console.log("14. Done Original Points: " + D_OP );
console.log("15. Added Points: " + AP );
console.log("16. Done Added Points: " + D_AP );
console.log("Changed estimates: " + CE);
console.log("Unestimated: " + UE);
console.log("The team completed " + D_OP + " of their originaly commited " + OP + " points.");
console.log("The team completed " + D_OS + " of their originaly commited " + OS + " stories.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment