mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-07 02:37:26 +08:00
[+] optOutOfLeaderboard
This commit is contained in:
@@ -9,6 +9,7 @@ import icu.samnyan.aqua.sega.allnet.KeychipSession
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import jakarta.persistence.*
|
||||
import lombok.Builder
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.security.crypto.password.PasswordEncoder
|
||||
import org.springframework.stereotype.Service
|
||||
@@ -52,6 +53,7 @@ class AquaNetUser(
|
||||
var profileLocation: String? = "",
|
||||
var profileBio: String? = "",
|
||||
var profilePicture: String? = "",
|
||||
var optOutOfLeaderboard: Boolean = false,
|
||||
|
||||
// Email confirmation
|
||||
var emailConfirmed: Boolean = false,
|
||||
@@ -194,4 +196,6 @@ class AquaUserServices(
|
||||
// Check if profile bio is valid
|
||||
if (length > 255) 400 - "Profile bio too long (max 255 letters)"
|
||||
}
|
||||
}
|
||||
|
||||
fun checkOptOutOfLeaderboard(optOutOfLeaderboard: Str) = optOutOfLeaderboard.toBoolean()
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class GameApiController<T : IUserData>(name: String, userDataClass: KCl
|
||||
// TODO: pagination
|
||||
// Shadow-ban: Do not show banned cards in the ranking except for the user who owns the card
|
||||
val players = userDataRepo.findAll().sortedByDescending { it.playerRating }
|
||||
.filter { it.card?.rankingBanned != true || it.card?.aquaUser?.let { it == reqUser } ?: false }
|
||||
.filter { (it.card?.rankingBanned != true && it.card?.aquaUser?.optOutOfLeaderboard != true) || it.card?.aquaUser?.let { it == reqUser } ?: false }
|
||||
return players.filter { it.card != null }.mapIndexed { i, user ->
|
||||
val card = user.card!!
|
||||
val plays = playlogRepo.findByUserCardExtId(card.extId)
|
||||
|
||||
Reference in New Issue
Block a user