How to best order issues using rank field and rest api?

Hello
I’m searching for the cheapest way to order issues on client side when ranking of issues changes. I’ll try to describe better what I have in mind.
There is jira board {BOARD] which has filter [FILTER] assigned. The filter has “order by rank asc” at the end.
There is an app [APP] that I’m creating using atlassian connect. That APP takes the FILTER and downloads all issues’ basic info according to it. The APP also has web hooks for jira:issue_updated, jira:issue_created and jira:issue_deleted events.
Now steps to get to my questions are:

  1. APP is started.
  2. APP downloads all issues according to the FILTER using ‘/rest/api/2/search’ POST api.
  3. Since the filter has “order by rank asc” all issues in the app are in proper order.
  4. Any user moves an issue on the BOARD so that the rank of the issue is changed.
  5. APP receives jira:issue_updated event with issue data, that includes info like:
"changelog": {
		"id": "10458",
		"items": [{
			"field": "Rank",
			"fieldtype": "custom",
			"fieldId": "customfield_10019",
			"from": "",
			"fromString": "",
			"to": "",
			"toString": "Ranked higher"
		}]
	}
  1. Now the APP knows that specific issue’s rank has changed.
    So how to put the issue into a proper place in the list of issues that the APP already has?

I was thinking about an api that could return me an issue that is before or after a given issue, but looks like such issue doesn’t exists.

The only solution that I can think about is to get all the issues in order again (as in step 2). Such operation seems expensive. If there are hundred of issues maybe even very expensive :frowning: .

Any idea how to solve such problem cheaper/better?

1 Like

Hello @ZbigniewPiecuch

In short, the answer is no; there is no way to do it better / cheaper. The rank of any single issue can’t be determined relative to any other single issue, ranking can only be determined collectively for all the issues.

Refer to this thread where the topic has been discussed before.

1 Like

That’s what I was afraid. Still was hoping for some clever JQL that could help me achieve that.
Thank you for quick answer.