tmp
Azalea 2024-04-20 09:33:53 +09:00
parent 8e882aafa1
commit 85296ae3b1
3 changed files with 35 additions and 16 deletions

View File

@ -20,7 +20,7 @@ data class TrendOut(val date: String, val rating: Int, val plays: Int)
data class RankCount(val name: String, val count: Int)
data class GenericGameSummary(
data class GameSummary(
val name: String,
val aquaUser: Map<String, Any?>?,
@ -42,7 +42,7 @@ data class GenericGameSummary(
val lastSeen: String,
val lastVersion: String,
val ratingComposition: Map<String, Any>,
val ratingComposition: RatingComposition,
val recent: List<IGenericGamePlaylog>
)
@ -102,6 +102,23 @@ interface IGenericGamePlaylog {
val isAllPerfect: Boolean
}
/**
* An entry of the best scores
*/
@Serializable
data class RatingCompositionEntry(
val music: Int,
val level: Int,
val achievement: Int,
val rating: Int
)
@Serializable
data class RatingComposition(
val bestNew: List<RatingCompositionEntry>,
val bestOld: List<RatingCompositionEntry>
)
@MappedSuperclass
open class BaseEntity(
@Id

View File

@ -29,14 +29,13 @@ class Maimai2(
) }
override suspend fun userSummary(@RP username: Str) = us.cardByName(username) { card ->
val extra = repos.userGeneralData.findByUser_Card_ExtId(card.extId)
.associate { it.propertyKey to it.propertyValue }
genericUserSummary(card) { u ->
val extra = repos.userGeneralData.findByUser(u).associate { it.propertyKey to it.propertyValue }
val ratingComposition = mapOf(
"best35" to (extra["recent_rating"] ?: ""),
"best15" to (extra["recent_rating_new"] ?: "")
)
genericUserSummary(card, ratingComposition)
RatingComposition(
bestOld = extra["recent_rating"] ?: "",
bestNew = extra["recent_rating_new"] ?: ""
)
}
}
}

View File

@ -4,21 +4,21 @@ import ext.*
import icu.samnyan.aqua.net.db.AquaUserServices
import icu.samnyan.aqua.net.games.*
import icu.samnyan.aqua.net.utils.waccaScores
import icu.samnyan.aqua.sega.wacca.model.db.WaccaRepos
import icu.samnyan.aqua.sega.wacca.model.db.WaccaUser
import icu.samnyan.aqua.sega.wacca.model.db.WcUserPlayLogRepo
import icu.samnyan.aqua.sega.wacca.model.db.WcUserRepo
import org.springframework.web.bind.annotation.RestController
@RestController
@API("api/v2/game/wacca")
class Wacca(
override val us: AquaUserServices,
override val playlogRepo: WcUserPlayLogRepo,
override val userDataRepo: WcUserRepo,
val rp: WaccaRepos,
): GameApiController<WaccaUser>("wacca", WaccaUser::class) {
override val settableFields: Map<String, (WaccaUser, String) -> Unit> by lazy { mapOf(
"userName" to usernameCheck(WACCA_USERNAME_CHARS),
) }
override val playlogRepo = rp.playLog
override val userDataRepo = rp.user
override suspend fun trend(@RP username: String) = us.cardByName(username) { card ->
findTrend(playlogRepo.findByUserCardExtId(card.extId)
@ -26,8 +26,11 @@ class Wacca(
}
override suspend fun userSummary(@RP username: String) = us.cardByName(username) { card ->
// TODO: Rating composition
genericUserSummary(card, mapOf())
genericUserSummary(card) {
val best50 = rp.bestScore.findTop50(it)
mapOf()
}
}
override val shownRanks: List<Pair<Int, String>> = waccaScores.filter { it.first > 85 * 10000 }