oslc REST API: get the Rank of items
Hello!
I'm working on a python script to generate some information and reports from our Team Concert. I'm using the oslc REST API of RTC. The relevant projects in RTC have a Scrum process and therewith are heavily organized by using the "rank". Installed RTC version is 4.0.1.
I am already able to get all work items and the iterations (Product Backlog and Sprint Backlogs). The only thing that is still missing for my purpose is the order (ranking) of the items within their iterations.
So the question is:
For a given work item, how can I get the rank via REST?
Or a possible alternative:
For a given iteration, how can I get a list of the assigned work items, ordered by the items rank?
Accepted answer
No as of today we do not have an api that fetches the rank values. The current design of ranking is such that only the sequence value is stored in the repository. The calculation of an integer ranking is done at the client side.
Thanks,
Sharoon
Comments
showing 5 of 7
show 2 more comments
One other answer
Hey Ben,
look at my post above. I use this approach at the moment and it's suitable. To fit the rank best, even if an item is not ranked within RTC, do a first sorting by the work item id.
I give you a short Python code snippet I use at the moment for the ranking. Maybe it's useful.
First, I put all items (in fact I use the history items, but that's not important) into a list and calculate a 4-tuple for each item like this:
aptPriority_nodes = history_node.findall("allExtensions[key='com.ibm.team.apt.attribute.planitem.priority._pm7NmRYUEd6L1tNIGdz5qQ']/smallStringValue")
priority = history_node.find('priority/id').text
id_rank_string = "%012d"%int(item.identifier)
if len(aptPriority_nodes) == 0 or aptPriority_nodes[0].text == None:
aptPriority = None
aptRank = None
else:
apt_parts = aptPriority_nodes[0].text.partition(' ')
aptPriority = apt_parts[0]
aptRank = apt_parts[2]
rank = (priority,aptPriority,aptRank,id_rank_string)
Than I can get a suitable ranking with this sorting:
for item in itemlist:
if item.get_rank()[2] == None:
logging.warn("Item %(id)s should get ranked but no ranking is provided by RTC! Ranking may be not in sync with RTC for this item."%({'id':item.identifier}))
if item.get_rank()[1] != None and item.get_rank()[1] != item.get_rank()[0]:
logging.warn("The priority of item %(id)s was set back to “Unassigned” that leads to an RTC internal inconsistency. Ranking may be not in sync with RTC for this item."%({'id':item.identifier}))
# first oder: by id, descending
itemlist.sort(key=lambda item: item.get_rank()[3],reverse=True)
# second order: by rank string
itemlist.sort(key=lambda item: item.get_rank()[2])
# by ranked or unranked
itemlist.sort(key=lambda item: item.get_rank()[1],reverse=True)
# last order: by priority literal, descending
itemlist.sort(key=lambda item: item.get_rank()[0],reverse=True)
It works for me. It's not so hard to investigate the logic. It's sad that RTC has no official and documented way to do that. I think it's a core functionality of real Backlog Management Tools.
Hope that helps.
Comments
Andrea Ianni
Jan 12 '17, 6:02 p.m.Liora Milbaum
Dec 07 '14, 7:43 a.m.Andrea Ianni
Dec 09 '14, 8:16 a.m.1 vote