mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-05 08:54:34 +00:00
[AB-84] adding necessary information to suggestion update message
This commit is contained in:
@@ -278,6 +278,9 @@ public class SuggestionServiceBean implements SuggestionService {
|
|||||||
Long agreements = suggestionVoteManagementService.getDecisionsForSuggestion(suggestion, SuggestionDecision.AGREE);
|
Long agreements = suggestionVoteManagementService.getDecisionsForSuggestion(suggestion, SuggestionDecision.AGREE);
|
||||||
Long disagreements = suggestionVoteManagementService.getDecisionsForSuggestion(suggestion, SuggestionDecision.DISAGREE);
|
Long disagreements = suggestionVoteManagementService.getDecisionsForSuggestion(suggestion, SuggestionDecision.DISAGREE);
|
||||||
Long suggestionId = suggestion.getSuggestionId().getId();
|
Long suggestionId = suggestion.getSuggestionId().getId();
|
||||||
|
Long totalVotes = disagreements + agreements;
|
||||||
|
float agreementPercentage = (float) agreements / (totalVotes) * 100;
|
||||||
|
float disAgreementPercentage = 100f - agreementPercentage;
|
||||||
SuggestionUpdateModel model = SuggestionUpdateModel
|
SuggestionUpdateModel model = SuggestionUpdateModel
|
||||||
.builder()
|
.builder()
|
||||||
.suggestionId(suggestionId)
|
.suggestionId(suggestionId)
|
||||||
@@ -290,6 +293,9 @@ public class SuggestionServiceBean implements SuggestionService {
|
|||||||
.text(suggestion.getSuggestionText())
|
.text(suggestion.getSuggestionText())
|
||||||
.originalChannelId(channelId)
|
.originalChannelId(channelId)
|
||||||
.reason(reason)
|
.reason(reason)
|
||||||
|
.totalVotes(totalVotes)
|
||||||
|
.agreementPercentage(agreementPercentage)
|
||||||
|
.disAgreementPercentage(disAgreementPercentage)
|
||||||
.build();
|
.build();
|
||||||
log.info("Updated posted suggestion {} in server {}.", suggestionId, suggestion.getServer().getId());
|
log.info("Updated posted suggestion {} in server {}.", suggestionId, suggestion.getServer().getId());
|
||||||
CompletableFuture<User> memberById = userService.retrieveUserForId(suggestion.getSuggester().getUserReference().getId());
|
CompletableFuture<User> memberById = userService.retrieveUserForId(suggestion.getSuggester().getUserReference().getId());
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ public class SuggestionUpdateModel {
|
|||||||
private Long originalMessageId;
|
private Long originalMessageId;
|
||||||
private Long agreeVotes;
|
private Long agreeVotes;
|
||||||
private Long disAgreeVotes;
|
private Long disAgreeVotes;
|
||||||
|
private Long totalVotes;
|
||||||
|
private Float agreementPercentage;
|
||||||
|
private Float disAgreementPercentage;
|
||||||
|
|
||||||
public String getOriginalMessageUrl() {
|
public String getOriginalMessageUrl() {
|
||||||
return MessageUtils.buildMessageUrl(serverId, originalChannelId , originalMessageId);
|
return MessageUtils.buildMessageUrl(serverId, originalChannelId , originalMessageId);
|
||||||
|
|||||||
Reference in New Issue
Block a user