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 votes
Accepted answer

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
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,148 views 0 8
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