Skip to content

Instantly share code, notes, and snippets.

@twolfson
Created November 15, 2012 20:26
Show Gist options
  • Save twolfson/4081042 to your computer and use it in GitHub Desktop.
Save twolfson/4081042 to your computer and use it in GitHub Desktop.
Grab total points from JIRA
$.get('{{XML_LOCATION}}', function (data, status) {
if (status === 'success') {
var $data = $(data),
$itemArr = $data.find('item'),
points = $itemArr.map(function () {
var $item = $(this),
$customFields = $item.find('customfield'),
$storyPointsField = $customFields.filter('{{STORY_POINT_FILTER'),
// $storyPointsField = $customFields.filter('[id="customfield_10004"]'),
storyPoints = +($storyPointsField.find('customfieldvalue').text() || 0);
return storyPoints;
}).toArray(),
total = points.reduce(function (a, b) { return a + b; }, 0);
console.log(total);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment