forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -31,11 +31,15 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class UserStats(val eventFightParticipation: Int, val eventParticipation: Int, val acceptedSchematics: Int, val fights: Int, val playtime: Double) {
|
||||
constructor(user: SteamwarUser): this(
|
||||
getEventFightParticipation(user) ?: 0,
|
||||
getEventParticipation(user) ?: 0,
|
||||
getAcceptedSchematics(user) ?: 0,
|
||||
getFightCount(user) ?: 0,
|
||||
constructor(user: SteamwarUser) : this(
|
||||
getEventFightParticipation(user)
|
||||
?: 0,
|
||||
getEventParticipation(user)
|
||||
?: 0,
|
||||
getAcceptedSchematics(user)
|
||||
?: 0,
|
||||
getFightCount(user)
|
||||
?: 0,
|
||||
user.getOnlinetime() / 3600.0
|
||||
)
|
||||
}
|
||||
@@ -43,7 +47,8 @@ data class UserStats(val eventFightParticipation: Int, val eventParticipation: I
|
||||
fun Route.configureStats() {
|
||||
route("/stats") {
|
||||
get("/ranked/{gamemode}") {
|
||||
val gamemode = call.parameters["gamemode"] ?: return@get call.respond(HttpStatusCode.NotFound)
|
||||
val gamemode = call.parameters["gamemode"]
|
||||
?: return@get call.respond(HttpStatusCode.NotFound)
|
||||
|
||||
@Serializable
|
||||
data class RankedUser(val name: String, val elo: Int)
|
||||
|
||||
Reference in New Issue
Block a user