Created
May 15, 2017 22:58
-
-
Save bbrown/d8e0ae7e4d2119f3820c04112c866aa7 to your computer and use it in GitHub Desktop.
Use JIRA's list of versions to get some quick and dirty date-based release counts
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
var versions = "Array from https://jira/rest/api/2/project/projectKey/versions"; | |
var dateRegex = /([0-9]{4})([0-9]{2})([0-9]{2})[0-9]{4}/; | |
var counts = {}; | |
versions.forEach(function(version) | |
{ | |
if (dateRegex.test(version.name)) | |
{ | |
var dateParts = dateRegex.exec(version.name); | |
var yearKey = "" + dateParts[1]; | |
var monthKey = "" + dateParts[1] + "-" + dateParts[2]; | |
var dayKey = "" + dateParts[1] + "-" + dateParts[2] + "-" + dateParts[3]; | |
if (!counts[yearKey]) | |
{ | |
counts[yearKey] = 1; | |
} | |
else | |
{ | |
counts[yearKey]++; | |
} | |
if (!counts[monthKey]) | |
{ | |
counts[monthKey] = 1; | |
} | |
else | |
{ | |
counts[monthKey]++; | |
} | |
if (!counts[dayKey]) | |
{ | |
counts[dayKey] = 1; | |
} | |
else | |
{ | |
counts[dayKey]++; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment