From 2ffbf939fe7a865d092aee63bf57a018c6b70046 Mon Sep 17 00:00:00 2001 From: Ayush Chadha Date: Fri, 12 Jan 2024 09:10:27 +0530 Subject: [PATCH] fix: return leadarboard top --- .../kotlin/delta/codecharacter/server/stats/StatsService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/delta/codecharacter/server/stats/StatsService.kt b/server/src/main/kotlin/delta/codecharacter/server/stats/StatsService.kt index aaab443..b0a9898 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/stats/StatsService.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/stats/StatsService.kt @@ -63,7 +63,8 @@ class StatsService(@Autowired private val statsRepository:StatsRepository, val topUserUUID = publicUserRepository.findAll(pageRequest).get().findFirst().get().userId val topUser = statsRepository.findById(topUserUUID).get() var lTop = convertToDTO(topUser) - if(!statsRepository.existsById(userId)){ + val userExists = statsRepository.existsById(userId) + if(!userExists || (userId == topUserUUID)){ l.add(lTop) return l }