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