Correct rank have wrong value
This commit is contained in:
parent
89f20e7644
commit
fd14936565
@ -165,19 +165,23 @@ public class UserStatsUtils {
|
||||
|
||||
List<UserStats> allStats = userStatsRepository.findByGuildId(guildId);
|
||||
List<GuildStats> ranked = new ArrayList<>();
|
||||
int i = 1;
|
||||
for(UserStats stats : allStats){
|
||||
String avatar = MainBot.jda.getUserById(stats.getUser().getJdaId()).getAvatarUrl();
|
||||
GuildStats temp = new GuildStats(stats.getUser().getName(), i, avatar, stats.getVocalTime(), stats.getMessageCount(), stats.getApiCommandCount());
|
||||
GuildStats temp = new GuildStats(stats.getUser().getName(), 0, avatar, stats.getVocalTime(), stats.getMessageCount(), stats.getApiCommandCount());
|
||||
if(stats.getUser().getId().equals(userEntity.getId())){
|
||||
selfGuildStats = temp;
|
||||
}
|
||||
ranked.add(temp);
|
||||
|
||||
i++;
|
||||
}
|
||||
ranked.sort((guildStats, t1) -> (int) (t1.total - guildStats.total));
|
||||
|
||||
int i = 1;
|
||||
for(GuildStats stat : ranked){
|
||||
stat.rank = i;
|
||||
i++;
|
||||
}
|
||||
|
||||
return new GuildStatsPack(ranked.indexOf(selfGuildStats) + 1 , selfGuildStats, ranked);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user