How to get the average count of participants?

JIRA Toolkit provides a custom field 'participants'. It seems, that the value of this field isn't stored in the database. So how could I get the average count of participants for an issue? Database is MSSQL 2008.

1 answer

1 accepted

0 vote

You don't. The field is "derived" - worked out on-the-fly from existing data and displayed.

You could try reading the Lucene index for it, as it's stored in there, but I wouldn't know how to go about that (I know it's possible to read Lucene indices outside Jira, but I'd need to look it up, and I'm not sure I'd implement it as the Lucene index is heavily used in Jira and I'd be hesitant to touch it)

For doing it in the database, you'd need to replicate the question the field answers. I'm not a DBA, my SQL is pretty basic and probably horrendously inefficient, so I'm not going to try it directly, but:

For each issue (jiraissue table), read the jiraissue.reporter, jiraissue.assignee, and all the jiraaction.author (join jiraaction to jiraissue on jiraaction.issueid = jiraissue.id). Deduplicate that list (for cases where assignee = reporter, multiple comments etc), and that's what the participants field shows.

I think that answers my question, also I am still struggling to create the right SQL query. That's the query I've got so far:

SELECT DISTINCT P.ID, P.Reporter, P.Assignee, S.Author AS 'Commented by' 
	FROM jiraaction S JOIN jiraissue P 
		ON (S.issueid = P.ID) 
ORDER BY P.ID

As result I got a table with issue ID, reporter, assignee and commentators. As there are multiple commentators I've got multiple lines for one issue. Using COUNT still fails at this point.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

850 views 2 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you