mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-26 05:44:42 +00:00
[AB-84] fixing incorrect calculation for agreement percentage
This commit is contained in:
@@ -279,8 +279,12 @@ public class SuggestionServiceBean implements SuggestionService {
|
||||
Long disagreements = suggestionVoteManagementService.getDecisionsForSuggestion(suggestion, SuggestionDecision.DISAGREE);
|
||||
Long suggestionId = suggestion.getSuggestionId().getId();
|
||||
Long totalVotes = disagreements + agreements;
|
||||
float agreementPercentage = (float) agreements / (totalVotes) * 100;
|
||||
float disAgreementPercentage = 100f - agreementPercentage;
|
||||
float agreementPercentage = 0;
|
||||
float disAgreementPercentage = 0;
|
||||
if(totalVotes > 0) {
|
||||
agreementPercentage = (((float) agreements) / totalVotes) * 100;
|
||||
disAgreementPercentage = 100f - agreementPercentage;
|
||||
}
|
||||
SuggestionUpdateModel model = SuggestionUpdateModel
|
||||
.builder()
|
||||
.suggestionId(suggestionId)
|
||||
|
||||
Reference in New Issue
Block a user