Beatmaps info
This commit is contained in:
parent
da232f737e
commit
825ac523c2
@ -16,7 +16,7 @@ import org.jooq.ForeignKey
|
||||
import org.jooq.Name
|
||||
import org.jooq.Record
|
||||
import org.jooq.Records
|
||||
import org.jooq.Row12
|
||||
import org.jooq.Row22
|
||||
import org.jooq.Schema
|
||||
import org.jooq.SelectField
|
||||
import org.jooq.Table
|
||||
@ -122,6 +122,56 @@ open class Beatmaps(
|
||||
*/
|
||||
val BEATMAP_HASH: TableField<BeatmapsRecord, String?> = createField(DSL.name("beatmap_hash"), SQLDataType.VARCHAR(32), this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.total_length</code>.
|
||||
*/
|
||||
val TOTAL_LENGTH: TableField<BeatmapsRecord, Int?> = createField(DSL.name("total_length"), SQLDataType.INTEGER, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.bpm</code>.
|
||||
*/
|
||||
val BPM: TableField<BeatmapsRecord, Double?> = createField(DSL.name("bpm"), SQLDataType.DOUBLE, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.accuracy</code>.
|
||||
*/
|
||||
val ACCURACY: TableField<BeatmapsRecord, Double?> = createField(DSL.name("accuracy"), SQLDataType.DOUBLE, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.ar</code>.
|
||||
*/
|
||||
val AR: TableField<BeatmapsRecord, Double?> = createField(DSL.name("ar"), SQLDataType.DOUBLE, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.cs</code>.
|
||||
*/
|
||||
val CS: TableField<BeatmapsRecord, Double?> = createField(DSL.name("cs"), SQLDataType.DOUBLE, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.drain</code>.
|
||||
*/
|
||||
val DRAIN: TableField<BeatmapsRecord, Double?> = createField(DSL.name("drain"), SQLDataType.DOUBLE, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.count_circles</code>.
|
||||
*/
|
||||
val COUNT_CIRCLES: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_circles"), SQLDataType.INTEGER, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.count_sliders</code>.
|
||||
*/
|
||||
val COUNT_SLIDERS: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_sliders"), SQLDataType.INTEGER, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.count_spinners</code>.
|
||||
*/
|
||||
val COUNT_SPINNERS: TableField<BeatmapsRecord, Int?> = createField(DSL.name("count_spinners"), SQLDataType.INTEGER, this, "")
|
||||
|
||||
/**
|
||||
* The column <code>public.beatmaps.max_combo</code>.
|
||||
*/
|
||||
val MAX_COMBO: TableField<BeatmapsRecord, Int?> = createField(DSL.name("max_combo"), SQLDataType.INTEGER, this, "")
|
||||
|
||||
private constructor(alias: Name, aliased: Table<BeatmapsRecord>?): this(alias, null, null, aliased, null)
|
||||
private constructor(alias: Name, aliased: Table<BeatmapsRecord>?, parameters: Array<Field<*>?>?): this(alias, null, null, aliased, parameters)
|
||||
|
||||
@ -163,18 +213,18 @@ open class Beatmaps(
|
||||
override fun rename(name: Table<*>): Beatmaps = Beatmaps(name.getQualifiedName(), null)
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row12 type methods
|
||||
// Row22 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
override fun fieldsRow(): Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?> = super.fieldsRow() as Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?>
|
||||
override fun fieldsRow(): Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?> = super.fieldsRow() as Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?>
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Function)}.
|
||||
*/
|
||||
fun <U> mapping(from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?) -> U): SelectField<U> = convertFrom(Records.mapping(from))
|
||||
fun <U> mapping(from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?) -> U): SelectField<U> = convertFrom(Records.mapping(from))
|
||||
|
||||
/**
|
||||
* Convenience mapping calling {@link SelectField#convertFrom(Class,
|
||||
* Function)}.
|
||||
*/
|
||||
fun <U> mapping(toType: Class<U>, from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?) -> U): SelectField<U> = convertFrom(toType, Records.mapping(from))
|
||||
fun <U> mapping(toType: Class<U>, from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?) -> U): SelectField<U> = convertFrom(toType, Records.mapping(from))
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ import java.time.OffsetDateTime
|
||||
|
||||
import org.jooq.Field
|
||||
import org.jooq.Record1
|
||||
import org.jooq.Record12
|
||||
import org.jooq.Row12
|
||||
import org.jooq.Record22
|
||||
import org.jooq.Row22
|
||||
import org.jooq.impl.UpdatableRecordImpl
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import org.jooq.impl.UpdatableRecordImpl
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRecord>(Beatmaps.BEATMAPS), Record12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?> {
|
||||
open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRecord>(Beatmaps.BEATMAPS), Record22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?> {
|
||||
|
||||
open var beatmapId: Int?
|
||||
set(value): Unit = set(0, value)
|
||||
@ -69,6 +69,46 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
set(value): Unit = set(11, value)
|
||||
get(): String? = get(11) as String?
|
||||
|
||||
open var totalLength: Int?
|
||||
set(value): Unit = set(12, value)
|
||||
get(): Int? = get(12) as Int?
|
||||
|
||||
open var bpm: Double?
|
||||
set(value): Unit = set(13, value)
|
||||
get(): Double? = get(13) as Double?
|
||||
|
||||
open var accuracy: Double?
|
||||
set(value): Unit = set(14, value)
|
||||
get(): Double? = get(14) as Double?
|
||||
|
||||
open var ar: Double?
|
||||
set(value): Unit = set(15, value)
|
||||
get(): Double? = get(15) as Double?
|
||||
|
||||
open var cs: Double?
|
||||
set(value): Unit = set(16, value)
|
||||
get(): Double? = get(16) as Double?
|
||||
|
||||
open var drain: Double?
|
||||
set(value): Unit = set(17, value)
|
||||
get(): Double? = get(17) as Double?
|
||||
|
||||
open var countCircles: Int?
|
||||
set(value): Unit = set(18, value)
|
||||
get(): Int? = get(18) as Int?
|
||||
|
||||
open var countSliders: Int?
|
||||
set(value): Unit = set(19, value)
|
||||
get(): Int? = get(19) as Int?
|
||||
|
||||
open var countSpinners: Int?
|
||||
set(value): Unit = set(20, value)
|
||||
get(): Int? = get(20) as Int?
|
||||
|
||||
open var maxCombo: Int?
|
||||
set(value): Unit = set(21, value)
|
||||
get(): Int? = get(21) as Int?
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Primary key information
|
||||
// -------------------------------------------------------------------------
|
||||
@ -76,11 +116,11 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
override fun key(): Record1<Int?> = super.key() as Record1<Int?>
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Record12 type implementation
|
||||
// Record22 type implementation
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
override fun fieldsRow(): Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?> = super.fieldsRow() as Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?>
|
||||
override fun valuesRow(): Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?> = super.valuesRow() as Row12<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?>
|
||||
override fun fieldsRow(): Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?> = super.fieldsRow() as Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?>
|
||||
override fun valuesRow(): Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?> = super.valuesRow() as Row22<Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?, Int?, Double?, Double?, Double?, Double?, Double?, Int?, Int?, Int?, Int?>
|
||||
override fun field1(): Field<Int?> = Beatmaps.BEATMAPS.BEATMAP_ID
|
||||
override fun field2(): Field<String?> = Beatmaps.BEATMAPS.ARTIST
|
||||
override fun field3(): Field<Int?> = Beatmaps.BEATMAPS.BEATMAPSET_ID
|
||||
@ -93,6 +133,16 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
override fun field10(): Field<String?> = Beatmaps.BEATMAPS.LAST_REPLAY_CHECK
|
||||
override fun field11(): Field<String?> = Beatmaps.BEATMAPS.BEATMAP_FILE
|
||||
override fun field12(): Field<String?> = Beatmaps.BEATMAPS.BEATMAP_HASH
|
||||
override fun field13(): Field<Int?> = Beatmaps.BEATMAPS.TOTAL_LENGTH
|
||||
override fun field14(): Field<Double?> = Beatmaps.BEATMAPS.BPM
|
||||
override fun field15(): Field<Double?> = Beatmaps.BEATMAPS.ACCURACY
|
||||
override fun field16(): Field<Double?> = Beatmaps.BEATMAPS.AR
|
||||
override fun field17(): Field<Double?> = Beatmaps.BEATMAPS.CS
|
||||
override fun field18(): Field<Double?> = Beatmaps.BEATMAPS.DRAIN
|
||||
override fun field19(): Field<Int?> = Beatmaps.BEATMAPS.COUNT_CIRCLES
|
||||
override fun field20(): Field<Int?> = Beatmaps.BEATMAPS.COUNT_SLIDERS
|
||||
override fun field21(): Field<Int?> = Beatmaps.BEATMAPS.COUNT_SPINNERS
|
||||
override fun field22(): Field<Int?> = Beatmaps.BEATMAPS.MAX_COMBO
|
||||
override fun component1(): Int? = beatmapId
|
||||
override fun component2(): String? = artist
|
||||
override fun component3(): Int? = beatmapsetId
|
||||
@ -105,6 +155,16 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
override fun component10(): String? = lastReplayCheck
|
||||
override fun component11(): String? = beatmapFile
|
||||
override fun component12(): String? = beatmapHash
|
||||
override fun component13(): Int? = totalLength
|
||||
override fun component14(): Double? = bpm
|
||||
override fun component15(): Double? = accuracy
|
||||
override fun component16(): Double? = ar
|
||||
override fun component17(): Double? = cs
|
||||
override fun component18(): Double? = drain
|
||||
override fun component19(): Int? = countCircles
|
||||
override fun component20(): Int? = countSliders
|
||||
override fun component21(): Int? = countSpinners
|
||||
override fun component22(): Int? = maxCombo
|
||||
override fun value1(): Int? = beatmapId
|
||||
override fun value2(): String? = artist
|
||||
override fun value3(): Int? = beatmapsetId
|
||||
@ -117,6 +177,16 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
override fun value10(): String? = lastReplayCheck
|
||||
override fun value11(): String? = beatmapFile
|
||||
override fun value12(): String? = beatmapHash
|
||||
override fun value13(): Int? = totalLength
|
||||
override fun value14(): Double? = bpm
|
||||
override fun value15(): Double? = accuracy
|
||||
override fun value16(): Double? = ar
|
||||
override fun value17(): Double? = cs
|
||||
override fun value18(): Double? = drain
|
||||
override fun value19(): Int? = countCircles
|
||||
override fun value20(): Int? = countSliders
|
||||
override fun value21(): Int? = countSpinners
|
||||
override fun value22(): Int? = maxCombo
|
||||
|
||||
override fun value1(value: Int?): BeatmapsRecord {
|
||||
set(0, value)
|
||||
@ -178,7 +248,57 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
return this
|
||||
}
|
||||
|
||||
override fun values(value1: Int?, value2: String?, value3: Int?, value4: String?, value5: String?, value6: Double?, value7: String?, value8: String?, value9: OffsetDateTime?, value10: String?, value11: String?, value12: String?): BeatmapsRecord {
|
||||
override fun value13(value: Int?): BeatmapsRecord {
|
||||
set(12, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value14(value: Double?): BeatmapsRecord {
|
||||
set(13, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value15(value: Double?): BeatmapsRecord {
|
||||
set(14, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value16(value: Double?): BeatmapsRecord {
|
||||
set(15, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value17(value: Double?): BeatmapsRecord {
|
||||
set(16, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value18(value: Double?): BeatmapsRecord {
|
||||
set(17, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value19(value: Int?): BeatmapsRecord {
|
||||
set(18, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value20(value: Int?): BeatmapsRecord {
|
||||
set(19, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value21(value: Int?): BeatmapsRecord {
|
||||
set(20, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun value22(value: Int?): BeatmapsRecord {
|
||||
set(21, value)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun values(value1: Int?, value2: String?, value3: Int?, value4: String?, value5: String?, value6: Double?, value7: String?, value8: String?, value9: OffsetDateTime?, value10: String?, value11: String?, value12: String?, value13: Int?, value14: Double?, value15: Double?, value16: Double?, value17: Double?, value18: Double?, value19: Int?, value20: Int?, value21: Int?, value22: Int?): BeatmapsRecord {
|
||||
this.value1(value1)
|
||||
this.value2(value2)
|
||||
this.value3(value3)
|
||||
@ -191,13 +311,23 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
this.value10(value10)
|
||||
this.value11(value11)
|
||||
this.value12(value12)
|
||||
this.value13(value13)
|
||||
this.value14(value14)
|
||||
this.value15(value15)
|
||||
this.value16(value16)
|
||||
this.value17(value17)
|
||||
this.value18(value18)
|
||||
this.value19(value19)
|
||||
this.value20(value20)
|
||||
this.value21(value21)
|
||||
this.value22(value22)
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached, initialised BeatmapsRecord
|
||||
*/
|
||||
constructor(beatmapId: Int? = null, artist: String? = null, beatmapsetId: Int? = null, creator: String? = null, source: String? = null, starRating: Double? = null, title: String? = null, version: String? = null, sysLastUpdate: OffsetDateTime? = null, lastReplayCheck: String? = null, beatmapFile: String? = null, beatmapHash: String? = null): this() {
|
||||
constructor(beatmapId: Int? = null, artist: String? = null, beatmapsetId: Int? = null, creator: String? = null, source: String? = null, starRating: Double? = null, title: String? = null, version: String? = null, sysLastUpdate: OffsetDateTime? = null, lastReplayCheck: String? = null, beatmapFile: String? = null, beatmapHash: String? = null, totalLength: Int? = null, bpm: Double? = null, accuracy: Double? = null, ar: Double? = null, cs: Double? = null, drain: Double? = null, countCircles: Int? = null, countSliders: Int? = null, countSpinners: Int? = null, maxCombo: Int? = null): this() {
|
||||
this.beatmapId = beatmapId
|
||||
this.artist = artist
|
||||
this.beatmapsetId = beatmapsetId
|
||||
@ -210,6 +340,16 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl<BeatmapsRe
|
||||
this.lastReplayCheck = lastReplayCheck
|
||||
this.beatmapFile = beatmapFile
|
||||
this.beatmapHash = beatmapHash
|
||||
this.totalLength = totalLength
|
||||
this.bpm = bpm
|
||||
this.accuracy = accuracy
|
||||
this.ar = ar
|
||||
this.cs = cs
|
||||
this.drain = drain
|
||||
this.countCircles = countCircles
|
||||
this.countSliders = countSliders
|
||||
this.countSpinners = countSpinners
|
||||
this.maxCombo = maxCombo
|
||||
resetChangedOnNotNull()
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +177,16 @@ data class ReplayData(
|
||||
val beatmap_star_rating: Double,
|
||||
val beatmap_creator: String,
|
||||
val beatmap_version: String,
|
||||
val beatmap_max_combo: Int?,
|
||||
val beatmap_total_length: Int?,
|
||||
val beatmap_bpm: Double?,
|
||||
val beatmap_accuracy: Double?,
|
||||
val beatmap_ar: Double?,
|
||||
val beatmap_cs: Double?,
|
||||
val beatmap_drain: Double?,
|
||||
val beatmap_count_circles: Int?,
|
||||
val beatmap_count_sliders: Int?,
|
||||
val beatmap_count_spinners: Int?,
|
||||
val score: Int,
|
||||
val mods: List<String>,
|
||||
val rank: String,
|
||||
|
||||
@ -84,12 +84,38 @@ class UploadReplayController(
|
||||
.set(BEATMAPS.SOURCE, beatmap.beatmapset.source)
|
||||
.set(BEATMAPS.BEATMAP_HASH, replay.beatmapHash)
|
||||
.set(BEATMAPS.BEATMAP_FILE, beatmapFile)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, beatmap.ar)
|
||||
.set(BEATMAPS.CS, beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, beatmap.bpm)
|
||||
.execute()
|
||||
}
|
||||
else {
|
||||
dslContext.update(BEATMAPS)
|
||||
.set(BEATMAPS.ARTIST, beatmap.beatmapset.artist)
|
||||
.set(BEATMAPS.TITLE, beatmap.beatmapset.title)
|
||||
.set(BEATMAPS.VERSION, beatmap.version)
|
||||
.set(BEATMAPS.CREATOR, beatmap.beatmapset.creator)
|
||||
.set(BEATMAPS.STAR_RATING, beatmap.difficulty_rating)
|
||||
.set(BEATMAPS.SOURCE, beatmap.beatmapset.source)
|
||||
.set(BEATMAPS.BEATMAP_HASH, replay.beatmapHash)
|
||||
.set(BEATMAPS.BEATMAP_FILE, beatmapFile)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, beatmap.ar)
|
||||
.set(BEATMAPS.CS, beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, beatmap.bpm)
|
||||
.where(BEATMAPS.BEATMAP_ID.eq(beatmap.id))
|
||||
.execute()
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.nisemoe.nise.database
|
||||
import com.nisemoe.generated.tables.references.BEATMAPS
|
||||
import com.nisemoe.generated.tables.references.SCORES
|
||||
import com.nisemoe.nise.osu.OsuApi
|
||||
import com.nisemoe.nise.osu.OsuApiModels
|
||||
import org.jooq.DSLContext
|
||||
import org.jooq.impl.DSL.avg
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
@ -130,6 +130,16 @@ class ScoreService(
|
||||
BEATMAPS.STAR_RATING,
|
||||
BEATMAPS.CREATOR,
|
||||
BEATMAPS.VERSION,
|
||||
BEATMAPS.TOTAL_LENGTH,
|
||||
BEATMAPS.MAX_COMBO,
|
||||
BEATMAPS.BPM,
|
||||
BEATMAPS.ACCURACY,
|
||||
BEATMAPS.AR,
|
||||
BEATMAPS.CS,
|
||||
BEATMAPS.DRAIN,
|
||||
BEATMAPS.COUNT_CIRCLES,
|
||||
BEATMAPS.COUNT_SPINNERS,
|
||||
BEATMAPS.COUNT_SLIDERS,
|
||||
SCORES.PP,
|
||||
SCORES.FRAMETIME,
|
||||
SCORES.UR,
|
||||
@ -180,6 +190,16 @@ class ScoreService(
|
||||
beatmap_star_rating = result.get(BEATMAPS.STAR_RATING, Double::class.java),
|
||||
beatmap_creator = result.get(BEATMAPS.CREATOR, String::class.java),
|
||||
beatmap_version = result.get(BEATMAPS.VERSION, String::class.java),
|
||||
beatmap_bpm = result.get(BEATMAPS.BPM, Double::class.java),
|
||||
beatmap_max_combo = result.get(BEATMAPS.MAX_COMBO, Int::class.java),
|
||||
beatmap_total_length = result.get(BEATMAPS.TOTAL_LENGTH, Int::class.java),
|
||||
beatmap_accuracy = result.get(BEATMAPS.ACCURACY, Double::class.java),
|
||||
beatmap_ar = result.get(BEATMAPS.AR, Double::class.java),
|
||||
beatmap_cs = result.get(BEATMAPS.CS, Double::class.java),
|
||||
beatmap_drain = result.get(BEATMAPS.DRAIN, Double::class.java),
|
||||
beatmap_count_circles = result.get(BEATMAPS.COUNT_CIRCLES, Int::class.java),
|
||||
beatmap_count_spinners = result.get(BEATMAPS.COUNT_SPINNERS, Int::class.java),
|
||||
beatmap_count_sliders = result.get(BEATMAPS.COUNT_SLIDERS, Int::class.java),
|
||||
pp = result.get(SCORES.PP, Double::class.java),
|
||||
frametime = result.get(SCORES.FRAMETIME, Double::class.java).toInt(),
|
||||
ur = result.get(SCORES.UR, Double::class.java),
|
||||
|
||||
@ -85,7 +85,17 @@ class OsuApiModels {
|
||||
val id: Int,
|
||||
val checksum: String? = null,
|
||||
val difficulty_rating: Double?,
|
||||
val version: String?
|
||||
val version: String?,
|
||||
val max_combo: Int?,
|
||||
val total_length: Int?,
|
||||
val bpm: Double?,
|
||||
val accuracy: Double?,
|
||||
val ar: Double?,
|
||||
val cs: Double?,
|
||||
val drain: Double?,
|
||||
val count_circles: Int?,
|
||||
val count_sliders: Int?,
|
||||
val count_spinners: Int?
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -167,6 +177,17 @@ class OsuApiModels {
|
||||
val version: String,
|
||||
val beatmapset_id: Long,
|
||||
val checksum: String? = null,
|
||||
|
||||
val max_combo: Int?,
|
||||
val total_length: Int?,
|
||||
val bpm: Double?,
|
||||
val accuracy: Double?,
|
||||
val ar: Double?,
|
||||
val cs: Double?,
|
||||
val drain: Double?,
|
||||
val count_circles: Int?,
|
||||
val count_sliders: Int?,
|
||||
val count_spinners: Int?
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -176,7 +197,7 @@ class OsuApiModels {
|
||||
val id: Long,
|
||||
val source: String,
|
||||
val title: String,
|
||||
val beatmaps: List<BeatmapCompact>?
|
||||
val beatmaps: List<BeatmapCompact>?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -186,7 +207,16 @@ class OsuApiModels {
|
||||
val id: Int,
|
||||
val version: String?,
|
||||
val beatmapset: BeatmapSet,
|
||||
val max_combo: Int?
|
||||
val max_combo: Int?,
|
||||
val total_length: Int?,
|
||||
val bpm: Double?,
|
||||
val accuracy: Double?,
|
||||
val ar: Double?,
|
||||
val cs: Double?,
|
||||
val drain: Double?,
|
||||
val count_circles: Int?,
|
||||
val count_sliders: Int?,
|
||||
val count_spinners: Int?
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
||||
@ -220,8 +220,40 @@ class ImportScores(
|
||||
.set(BEATMAPS.SOURCE, topScore.beatmapset.source)
|
||||
.set(BEATMAPS.CREATOR, topScore.beatmapset.creator)
|
||||
.set(BEATMAPS.BEATMAP_FILE, beatmapFile)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, topScore.beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, topScore.beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, topScore.beatmap.ar)
|
||||
.set(BEATMAPS.CS, topScore.beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, topScore.beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, topScore.beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, topScore.beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, topScore.beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, topScore.beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, topScore.beatmap.bpm)
|
||||
.execute()
|
||||
this.statistics.beatmapsAddedToDatabase++
|
||||
} else {
|
||||
dslContext.update(BEATMAPS)
|
||||
.set(BEATMAPS.BEATMAP_HASH, topScore.beatmap.checksum)
|
||||
.set(BEATMAPS.STAR_RATING, topScore.beatmap.difficulty_rating)
|
||||
.set(BEATMAPS.VERSION, beatmap.version)
|
||||
.set(BEATMAPS.ARTIST, topScore.beatmapset!!.artist)
|
||||
.set(BEATMAPS.SOURCE, topScore.beatmapset.source)
|
||||
.set(BEATMAPS.TITLE, topScore.beatmapset.title)
|
||||
.set(BEATMAPS.SOURCE, topScore.beatmapset.source)
|
||||
.set(BEATMAPS.CREATOR, topScore.beatmapset.creator)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, topScore.beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, topScore.beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, topScore.beatmap.ar)
|
||||
.set(BEATMAPS.CS, topScore.beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, topScore.beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, topScore.beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, topScore.beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, topScore.beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, topScore.beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, topScore.beatmap.bpm)
|
||||
.where(BEATMAPS.BEATMAP_ID.eq(topScore.beatmap.id))
|
||||
.execute()
|
||||
}
|
||||
|
||||
// Update the database
|
||||
@ -363,6 +395,28 @@ class ImportScores(
|
||||
.now(ZoneOffset.UTC)
|
||||
.minusDays(3)
|
||||
|
||||
dslContext.update(BEATMAPS)
|
||||
.set(BEATMAPS.BEATMAP_HASH, beatmap.checksum)
|
||||
.set(BEATMAPS.STAR_RATING, beatmap.difficulty_rating)
|
||||
.set(BEATMAPS.VERSION, beatmap.version)
|
||||
.set(BEATMAPS.ARTIST, beatmapset.artist)
|
||||
.set(BEATMAPS.SOURCE, beatmapset.source)
|
||||
.set(BEATMAPS.TITLE, beatmapset.title)
|
||||
.set(BEATMAPS.SOURCE, beatmapset.source)
|
||||
.set(BEATMAPS.CREATOR, beatmapset.creator)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, beatmap.ar)
|
||||
.set(BEATMAPS.CS, beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, beatmap.bpm)
|
||||
.where(BEATMAPS.BEATMAP_ID.eq(beatmap.id))
|
||||
.execute()
|
||||
|
||||
if(dslContext.fetchExists(BEATMAPS, BEATMAPS.BEATMAP_ID.eq(beatmap.id).and(BEATMAPS.SYS_LAST_UPDATE.greaterOrEqual(threeDaysAgo)))) {
|
||||
this.statistics.beatmapsSkippedBecauseTooRecent++
|
||||
this.logger.debug("Skipping beatmap since it's been updated in the last few days.")
|
||||
@ -385,6 +439,17 @@ class ImportScores(
|
||||
.set(BEATMAPS.SOURCE, beatmapset.source)
|
||||
.set(BEATMAPS.CREATOR, beatmapset.creator)
|
||||
.set(BEATMAPS.BEATMAP_FILE, beatmapFile)
|
||||
.set(BEATMAPS.TOTAL_LENGTH, beatmap.total_length)
|
||||
.set(BEATMAPS.ACCURACY, beatmap.accuracy)
|
||||
.set(BEATMAPS.AR, beatmap.ar)
|
||||
.set(BEATMAPS.CS, beatmap.cs)
|
||||
.set(BEATMAPS.DRAIN, beatmap.drain)
|
||||
.set(BEATMAPS.COUNT_CIRCLES, beatmap.count_circles)
|
||||
.set(BEATMAPS.COUNT_SLIDERS, beatmap.count_sliders)
|
||||
.set(BEATMAPS.COUNT_SPINNERS, beatmap.count_spinners)
|
||||
.set(BEATMAPS.MAX_COMBO, beatmap.max_combo)
|
||||
.set(BEATMAPS.BPM, beatmap.bpm)
|
||||
|
||||
.execute()
|
||||
this.statistics.beatmapsAddedToDatabase++
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
ALTER TABLE public.beatmaps
|
||||
ADD COLUMN total_length int,
|
||||
ADD COLUMN bpm float8,
|
||||
ADD COLUMN accuracy float8,
|
||||
ADD COLUMN ar float8,
|
||||
ADD COLUMN cs float8,
|
||||
ADD COLUMN drain float8,
|
||||
ADD COLUMN count_circles int,
|
||||
ADD COLUMN count_sliders int,
|
||||
ADD COLUMN count_spinners int,
|
||||
ADD COLUMN max_combo int;
|
||||
@ -79,6 +79,16 @@ export function getMockReplayData(): ReplayData {
|
||||
'beatmap_star_rating': 123,
|
||||
'beatmap_creator': 'beatmap_creator',
|
||||
'beatmap_version': 'beatmap_version',
|
||||
'beatmap_max_combo': 123,
|
||||
'beatmap_total_length': 123,
|
||||
'beatmap_bpm': 123,
|
||||
'beatmap_accuracy': 123,
|
||||
'beatmap_ar': 123,
|
||||
'beatmap_cs': 123,
|
||||
'beatmap_drain': 123,
|
||||
'beatmap_count_circles': 123,
|
||||
'beatmap_count_sliders': 123,
|
||||
'beatmap_count_spinners': 123,
|
||||
'score': 123,
|
||||
'mods': ['mods'],
|
||||
'rank': 'rank',
|
||||
@ -122,6 +132,16 @@ export interface ReplayData {
|
||||
beatmap_star_rating: number;
|
||||
beatmap_creator: string;
|
||||
beatmap_version: string;
|
||||
beatmap_max_combo: number;
|
||||
beatmap_total_length: number;
|
||||
beatmap_bpm: number;
|
||||
beatmap_accuracy: number;
|
||||
beatmap_ar: number;
|
||||
beatmap_cs: number;
|
||||
beatmap_drain: number;
|
||||
beatmap_count_circles: number;
|
||||
beatmap_count_sliders: number;
|
||||
beatmap_count_spinners: number;
|
||||
score: number;
|
||||
mods: string[];
|
||||
rank: string;
|
||||
|
||||
@ -60,11 +60,65 @@
|
||||
<div style="padding: 16px">
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<div style="flex: 1; padding-right: 10px;" class="text-center">
|
||||
<div style="flex: 1; padding-right: 30px;" class="text-center">
|
||||
<h2>
|
||||
{{ this.replayData.beatmap_title }} <span class="text-muted">by</span> {{ this.replayData.beatmap_artist }}
|
||||
</h2>
|
||||
<span class="badge">★{{ this.replayData.beatmap_star_rating | number: '1.0-2' }}</span> {{ this.replayData.beatmap_version }}
|
||||
|
||||
<div class="stats-container">
|
||||
<div class="stat" *ngIf="this.replayData.beatmap_total_length">
|
||||
<span class="stat-label">Length</span>
|
||||
<span class="stat-value">{{ printTotalLength(this.replayData.beatmap_total_length) }}</span>
|
||||
</div>
|
||||
<div class="stat" *ngIf="this.replayData.beatmap_bpm">
|
||||
<span class="stat-label">BPM</span>
|
||||
<span class="stat-value">{{ this.replayData.beatmap_bpm | number: '1.0-1' }}</span>
|
||||
</div>
|
||||
<div class="stat" *ngIf="this.replayData.beatmap_count_circles">
|
||||
<span class="stat-label">Circles</span>
|
||||
<span class="stat-value">{{ this.replayData.beatmap_count_circles }}</span>
|
||||
</div>
|
||||
<div class="stat" *ngIf="this.replayData.beatmap_count_sliders">
|
||||
<span class="stat-label">Sliders</span>
|
||||
<span class="stat-value">{{ this.replayData.beatmap_count_sliders }}</span>
|
||||
</div>
|
||||
<div class="stat" *ngIf="this.replayData.beatmap_count_spinners">
|
||||
<span class="stat-label">Spinners</span>
|
||||
<span class="stat-value">{{ this.replayData.beatmap_count_spinners }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<table>
|
||||
<tr *ngIf="this.replayData.beatmap_cs">
|
||||
<td>Circle Size</td>
|
||||
<td>{{ this.replayData.beatmap_cs | number: '1.0-1' }}</td>
|
||||
<td>
|
||||
<app-cute-progressbar [value]="this.replayData.beatmap_cs" [max]="10"></app-cute-progressbar>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="this.replayData.beatmap_drain">
|
||||
<td>HP Drain</td>
|
||||
<td>{{ this.replayData.beatmap_drain | number: '1.0-1' }}</td>
|
||||
<td>
|
||||
<app-cute-progressbar [value]="this.replayData.beatmap_drain" [max]="10"></app-cute-progressbar>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="this.replayData.beatmap_accuracy">
|
||||
<td>Accuracy</td>
|
||||
<td>{{ this.replayData.beatmap_accuracy | number: '1.0-1' }}</td>
|
||||
<td>
|
||||
<app-cute-progressbar [value]="this.replayData.beatmap_accuracy" [max]="10"></app-cute-progressbar>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="this.replayData.beatmap_ar">
|
||||
<td>Approach Rate</td>
|
||||
<td>{{ this.replayData.beatmap_ar | number: '1.0-1' }}</td>
|
||||
<td>
|
||||
<app-cute-progressbar [value]="this.replayData.beatmap_ar" [max]="10"></app-cute-progressbar>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div style="flex: 1; padding-right: 10px;">
|
||||
<div class="stats-container">
|
||||
|
||||
@ -14,6 +14,7 @@ import {ChartComponent} from "../../corelib/components/chart/chart.component";
|
||||
import {
|
||||
ChartHitDistributionComponent
|
||||
} from "../../corelib/components/chart-hit-distribution/chart-hit-distribution.component";
|
||||
import {CuteProgressbarComponent} from "../../corelib/components/cute-progressbar/cute-progressbar.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-score',
|
||||
@ -28,7 +29,8 @@ import {
|
||||
RouterLink,
|
||||
OsuGradeComponent,
|
||||
ChartComponent,
|
||||
ChartHitDistributionComponent
|
||||
ChartHitDistributionComponent,
|
||||
CuteProgressbarComponent
|
||||
],
|
||||
templateUrl: './view-score.component.html',
|
||||
styleUrl: './view-score.component.css'
|
||||
@ -61,6 +63,16 @@ export class ViewScoreComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the total_length (a positive integer) into a timer-like string (e.g. 3:45)
|
||||
* @param total_length
|
||||
*/
|
||||
printTotalLength(total_length: number): string {
|
||||
let minutes = Math.floor(total_length / 60);
|
||||
let seconds = total_length % 60;
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
buildCircleguardUrl(): string {
|
||||
if(!this.replayData) {
|
||||
return "";
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
<div style="width: 100px; border: 1px solid #a8a8a8;">
|
||||
<div [style.width.%]="width" style="height: 10px; background-color: #fff;"></div>
|
||||
</div>
|
||||
@ -0,0 +1,19 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cute-progressbar',
|
||||
standalone: true,
|
||||
imports: [],
|
||||
templateUrl: './cute-progressbar.component.html',
|
||||
styleUrl: './cute-progressbar.component.css'
|
||||
})
|
||||
export class CuteProgressbarComponent {
|
||||
|
||||
@Input() value: number = 0;
|
||||
@Input() max: number = 100;
|
||||
|
||||
get width() {
|
||||
return Math.min(100, (this.value / this.max) * 100);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user