Voting information on issue showing incorrect count in Jira
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When clicking the vote count number while on issue view, the number of users displayed does not match the count value.
Environment
8.13.10, 8.20.3 but should apply to all versions.
Diagnosis
A behavior similar to the below is seen when you click on the number in front of Vote for this issue .
It is not limited to cases where There are no voters for this issue is shown -the count may be higher or lower than the number of users displayed.
Cause
The root cause is unknown, but it could be caused by database corruption or direct manipulation.
The reason it can be left in an inconsistent state is because the count is fetched from jiraissue
table on votes
field and the user list displayed is fetched from jiraissue
and userassociation
tables. There are no constraints to ensure they remain in sync.
Solution
The first step should be confirming the inconsistency on the database:
Get the count of votes for the given issue from
jiraissue
(replace PKEY-11 with your issue key):
1
2
3
4
SELECT p.pkey||'-'||i.issuenum as issueKey, i.id as issueId, votes
FROM jiraissue i,
project p
WHERE i.project = p.id and p.pkey||'-'||i.issuenum='PKEY-11';
Get the list of users with a "VoteIssue" association type on
userassociation
(replace PKEY-11 with your issue key):
1
2
3
4
5
6
7
8
SELECT p.pkey||'-'||i.issuenum as issueKey, i.id as issueId, count(*) as userCountFromUserAssociation
FROM jiraissue i,
userassociation a,
project p
WHERE ASSOCIATION_TYPE = 'VoteIssue'
and i.ID = a.SINK_NODE_ID
and i.project = p.id and p.pkey||'-'||i.issuenum='PKEY-11'
group by p.pkey||'-'||i.issuenum, i.id;
Once you confirm the counts do not match, you may update the jiraissue
:
Replace <COUNT> with the third value from the second query and <ISSUEID> with the second value from previous query:
1
update jiraissue set votes=<COUNT> where id=<ISSUEID>;
This does not require a restart to reflect in the UI.
Was this helpful?