oslc REST API: get the Rank of items
Accepted answer
Comments
Hello Sharoon,
You can read more details in the article https://jazz.net/library/article/1033, if you have not yet seen it.
Hmm... maybe we have a little misunderstanding. :)
The value that you see here is what is stored as it is in the repository. It needs to be processed and presented in a representation that can be understood and interpreted by the user. Currently since we do not officially support an api to fetch the Rank values, its missing. There is an existing enhancement to view the rank values in a query in eclipse client which also has the same underlying reason for not being supported.
Cannot query on rank number of work item in queries (186360)
Thanks for that info.
Any info on this (however informal/unsupported) would be hugely helpful...I really need to be able to get/set rank from the API
see my post below.... :)
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
Thanks Daniel, great example.
Comments
Andrea Ianni
Jan 12 '17, 6:02 p.m.Hi all,
always about RANK values, is it this value stored in db or dw?
If yes, where?
I need to get this value and use in one custom BIRT report based on one JDBC data source.
Thanks in advance
Andrea
Liora Milbaum
Dec 07 '14, 7:43 a.m.Andrea, Did you find a solution how to present the RANK value in a BIRT report?
Andrea Ianni
Dec 09 '14, 8:16 a.m.Hi Liora
no, I did found no solution for that :(
At the moment, we use a custom attribute in order to sort our stories/epics.
Ciao
Andrea
1 vote