mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-09-30 10:48:08 +03:00
feat: display ongeki refresh data on web ui
Co-authored-by: Azalea <noreply@aza.moe>
This commit is contained in:
@@ -57,7 +57,7 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
||||
val time = millis()
|
||||
|
||||
// Check cache validity
|
||||
if (rankingCache.isEmpty()) (500 - "Rank is empty or is currently computing. Please come back later.")
|
||||
if (rankingCache.isEmpty()) (500 - "Rank is empty or is currently computing.")
|
||||
|
||||
val reqUser = token?.let { us.jwt.auth(it) }?.let { u ->
|
||||
// Optimization: If the user is not banned, we don't need to process user information
|
||||
@@ -98,7 +98,7 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
||||
SUM(p.is_full_combo) AS fc,
|
||||
SUM(p.is_all_perfect) AS ap,
|
||||
c.ranking_banned or a.opt_out_of_leaderboard or c.status = 12 AS hide,
|
||||
a.username
|
||||
a.username ${if (name == "ongeki") ", u.new_player_rating" else ""}
|
||||
FROM ${tableName}_user_playlog_view p
|
||||
JOIN ${tableName}_user_data_view u ON p.user_id = u.id
|
||||
JOIN sega_card c ON u.aime_card_id = c.id
|
||||
@@ -115,7 +115,8 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
||||
accuracy = it[4]!!.double,
|
||||
fullCombo = it[5]!!.int,
|
||||
allPerfect = it[6]!!.int,
|
||||
username = it[8]?.toString() ?: "user${it[0]}"
|
||||
username = it[8]?.toString() ?: "user${it[0]}",
|
||||
modernRating = if (name == "ongeki") it[9]?.int() ?: 0 else 0
|
||||
)
|
||||
}
|
||||
rankingSortedIndex = rankingCache.filter { !it.l }.map { it.r.rating }.reversed()
|
||||
|
||||
@@ -59,7 +59,8 @@ data class GenericRankingPlayer(
|
||||
val rating: Int,
|
||||
val allPerfect: Int,
|
||||
val fullCombo: Int,
|
||||
val lastSeen: String
|
||||
val lastSeen: String,
|
||||
val modernRating: Int = 0
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
||||
@@ -60,7 +60,7 @@ class Maimai2(
|
||||
|
||||
val ratingComposition = mapOf(
|
||||
"best35" to (extra["recent_rating"] ?: ""),
|
||||
"best15" to (extra["recent_rating_new"] ?: "")
|
||||
"new15" to (extra["recent_rating_new"] ?: "")
|
||||
)
|
||||
|
||||
// if isLogin than boolean or null
|
||||
|
||||
@@ -42,16 +42,35 @@ class Ongeki(
|
||||
) }
|
||||
|
||||
override suspend fun userSummary(username: String, token: String?) = us.cardByName(username) { card ->
|
||||
val user = userDataRepo.findByCard_ExtId(card.extId) ?: (404 - "User not found")
|
||||
val extra = userGeneralDataRepository.findByUser_Card_ExtId(card.extId)
|
||||
.associate { it.propertyKey to it.propertyValue }
|
||||
|
||||
val ratingComposition = mapOf(
|
||||
"best30" to (extra["rating_base_best"] ?: ""),
|
||||
"best15" to (extra["rating_base_new_best"] ?: ""),
|
||||
"recent10" to (extra["rating_base_hot_best"] ?: "")
|
||||
)
|
||||
val isRefresh = user.newHighestRating > 0
|
||||
if (isRefresh)
|
||||
genericUserSummary(card, mapOf(
|
||||
"best50" to (extra["new_rating_base_best"] ?: ""),
|
||||
"new10" to (extra["new_rating_base_new_best"] ?: ""),
|
||||
"best25_candidates" to (extra["new_rating_base_next_best"] ?: ""),
|
||||
"pscore" to (extra["new_rating_base_pscore"] ?: "")
|
||||
))
|
||||
else
|
||||
genericUserSummary(card, mapOf(
|
||||
"best30" to (extra["rating_base_best"] ?: ""),
|
||||
"new15" to (extra["rating_base_new_best"] ?: ""),
|
||||
"recent10" to (extra["rating_base_hot_best"] ?: "")
|
||||
))
|
||||
}
|
||||
|
||||
genericUserSummary(card, ratingComposition)
|
||||
@API("refresh-data")
|
||||
suspend fun refreshData(@RP username: String) = us.cardByName(username) { card ->
|
||||
val user = userDataRepo.findByCard_ExtId(card.extId) ?: (404 - "User not found")
|
||||
if (user.newHighestRating > 0)
|
||||
mapOf(
|
||||
"playerRating" to user.newPlayerRating,
|
||||
"highestRating" to user.newHighestRating
|
||||
)
|
||||
else (400 - "User has not played Refresh")
|
||||
}
|
||||
|
||||
@API("user-option")
|
||||
|
||||
Reference in New Issue
Block a user