Fix more terminology

This commit is contained in:
pixtaded 2025-03-16 22:46:45 +03:00
parent 48b3f90184
commit 2e28b3ab4b

View File

@ -43,21 +43,21 @@ public class OnMessageReceivedEvent extends ListenerAdapter {
if (embed.getType() == EmbedType.POLL_RESULT) {
List<Field> fields = embed.getFields();
int victoryAnswerPolls = 0;
int totalPolls = 0;
int victoryAnswerVotes = 0;
int totalVotes = 0;
int victoryAnswerId = 0;
for (Field field : fields) {
switch (Objects.requireNonNull(field.getName())) {
case "victor_answer_id" -> victoryAnswerId = fieldToInt(field);
case "victor_answer_polls" -> victoryAnswerPolls = fieldToInt(field);
case "total_polls" -> totalPolls = fieldToInt(field);
case "victor_answer_votes" -> victoryAnswerVotes = fieldToInt(field);
case "total_votes" -> totalVotes = fieldToInt(field);
}
}
boolean someoneAnswered = totalPolls != 0;
boolean someoneAnswered = totalVotes != 0;
double victoryPercentage = (victoryAnswerPolls / (double) totalPolls) * 100;
double victoryPercentage = (victoryAnswerVotes / (double) totalVotes) * 100;
double otherPercentage = 100 - victoryPercentage;
String positive = "✅ Да";
@ -86,13 +86,13 @@ public class OnMessageReceivedEvent extends ListenerAdapter {
.addField(
new Field(victoryAnswerText,
String.format("%.0f%% (%d)", victoryPercentage,
victoryAnswerPolls),
victoryAnswerVotes),
false))
.addField(
new Field(otherAnswerText,
String.format("%.0f%% (%d)", otherPercentage,
totalPolls
- victoryAnswerPolls),
totalVotes
- victoryAnswerVotes),
false));
messageBuilder.addEmbeds(resultEmbed.build());
}