Here is an example of REST API that would import Week cycle as Sprint property.
This Sprint property will pick the Sprint start date and show it to the Monday of that week, and import the property with this pattern: %yW%U, %b %d %Y, for example, 20W39, Sep 28 2020 - year, week number, and week start date)
To use this code:
-
In Source Data (where you already have Jira as a data source), select “Add new source application”.
-
Chose the option to “import definition” and paste in the code below:
Import definition for new data source
{
"application_type": "rest_api",
"application_params": {
"source_params": {
"url": "http://jira811.internal:8810/rest/agile/1.0/board?type=scrum",
"pagination": "offset_limit",
"incremental": null,
"incremental_stop_import": null,
"authentication_type": "basic",
"username": "admin",
"content_type": "json",
"custom_javascript_code": "\n\n// retrieves all sprints within one board and will go from the last sprint and rank decreasingly closed sprints\nvar sprints = [{\n sprint_id: null,\n sprint_week: null \n}];\nvar allSprints = [];\nvar allSprintsLoaded = false;\nstartAt = 0;\nmaxResult = 50;\nif (doc.type == \"scrum\") {\n\n do \n {\n result = getDocument( \"/rest/agile/1.0/board/\" + doc.id + \"/sprint?startAt=\" + startAt + \"&maxResults=\" + maxResult, {ignoreErrors: \"404\"});\n if (result && result.values ) {\n allSprints = allSprints.concat(result.values);\n allSprintsLoaded = result.isLast;\n startAt = startAt + maxResult;\n }\n }\n while (!allSprintsLoaded); \n \n if (allSprints ) { \n for(var i = 0; i < allSprints.length; i++) {\n var sprint = allSprints[i];\n if (sprint && sprint.originBoardId == doc.id ) {\n \n if (sprint.startDate) {\n date = new Date(Date.parse(sprint.startDate));\n date.setUTCDate(date.getUTCDate() + 1 - (date.getUTCDay()||7));\n sprints.push({\n sprint_id: sprint.id,\n sprint_week: strftime(\"%yW%U, %b %d %Y\", date)\n });\n }\n }\n }\n} \n\n}\nreturn _.uniq(sprints);",
"json_data_path": "$.values",
"offset_parameter": "startAt",
"limit_parameter": "maxResults",
"limit_value": 50
},
"extra_options": {
"regular_import_frequency": null,
"regular_import_at": "",
"time_zone": "Helsinki"
}
},
"source_cube_name": "Issues",
"columns": [
{
"name": "sprint_id",
"data_type": "integer",
"dimension": "Sprint",
"dimension_level": "Sprint",
"key_column": true,
"skip_missing": true
},
{
"name": "sprint_week",
"data_type": "string",
"dimension": "Sprint",
"dimension_level": "Sprint",
"property": "Week cycle"
}
]
}
-
Adjust the REST API source parameters (URL, authentification) to match your Jira instance (Import from REST API)
-
Import data.
-
In the report, Sprint dimension, choose to add custom hierarchy and select property “Weekly cycle” (Create reports).
Here are several reports in eazyBI Demo Training account created based on this custom hierarchy:
Sprints by weeks balance
Sprints by weeks velocity
Sprints by weeks current cycle story points burn-down
Best,
Zane / support@eazyBI.com