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.
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.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Atlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
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!
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