From 825ac523c23de4d07996135a7b235731dd640ff3 Mon Sep 17 00:00:00 2001 From: "nise.moe" Date: Wed, 6 Mar 2024 13:17:37 +0100 Subject: [PATCH] Beatmaps info --- .../com/nisemoe/generated/tables/Beatmaps.kt | 60 ++++++- .../tables/records/BeatmapsRecord.kt | 156 +++++++++++++++++- .../main/kotlin/com/nisemoe/nise/Models.kt | 10 ++ .../nise/controller/UploadReplayController.kt | 26 +++ .../nisemoe/nise/database/BeatmapService.kt | 1 + .../com/nisemoe/nise/database/ScoreService.kt | 20 +++ .../com/nisemoe/nise/osu/OsuApiModels.kt | 36 +++- .../nisemoe/nise/scheduler/ImportScores.kt | 65 ++++++++ .../migration/V0.0.1.030__alter_beatmaps.sql | 11 ++ nise-frontend/src/app/replays.ts | 20 +++ .../app/view-score/view-score.component.html | 56 ++++++- .../app/view-score/view-score.component.ts | 14 +- .../cute-progressbar.component.css | 0 .../cute-progressbar.component.html | 3 + .../cute-progressbar.component.ts | 19 +++ 15 files changed, 479 insertions(+), 18 deletions(-) create mode 100644 nise-backend/src/main/resources/db/migration/V0.0.1.030__alter_beatmaps.sql create mode 100644 nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.css create mode 100644 nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.html create mode 100644 nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.ts diff --git a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Beatmaps.kt b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Beatmaps.kt index 41cbe96..a067553 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Beatmaps.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Beatmaps.kt @@ -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 = createField(DSL.name("beatmap_hash"), SQLDataType.VARCHAR(32), this, "") + /** + * The column public.beatmaps.total_length. + */ + val TOTAL_LENGTH: TableField = createField(DSL.name("total_length"), SQLDataType.INTEGER, this, "") + + /** + * The column public.beatmaps.bpm. + */ + val BPM: TableField = createField(DSL.name("bpm"), SQLDataType.DOUBLE, this, "") + + /** + * The column public.beatmaps.accuracy. + */ + val ACCURACY: TableField = createField(DSL.name("accuracy"), SQLDataType.DOUBLE, this, "") + + /** + * The column public.beatmaps.ar. + */ + val AR: TableField = createField(DSL.name("ar"), SQLDataType.DOUBLE, this, "") + + /** + * The column public.beatmaps.cs. + */ + val CS: TableField = createField(DSL.name("cs"), SQLDataType.DOUBLE, this, "") + + /** + * The column public.beatmaps.drain. + */ + val DRAIN: TableField = createField(DSL.name("drain"), SQLDataType.DOUBLE, this, "") + + /** + * The column public.beatmaps.count_circles. + */ + val COUNT_CIRCLES: TableField = createField(DSL.name("count_circles"), SQLDataType.INTEGER, this, "") + + /** + * The column public.beatmaps.count_sliders. + */ + val COUNT_SLIDERS: TableField = createField(DSL.name("count_sliders"), SQLDataType.INTEGER, this, "") + + /** + * The column public.beatmaps.count_spinners. + */ + val COUNT_SPINNERS: TableField = createField(DSL.name("count_spinners"), SQLDataType.INTEGER, this, "") + + /** + * The column public.beatmaps.max_combo. + */ + val MAX_COMBO: TableField = createField(DSL.name("max_combo"), SQLDataType.INTEGER, this, "") + private constructor(alias: Name, aliased: Table?): this(alias, null, null, aliased, null) private constructor(alias: Name, aliased: Table?, parameters: Array?>?): 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 = super.fieldsRow() as Row12 + override fun fieldsRow(): Row22 = super.fieldsRow() as Row22 /** * Convenience mapping calling {@link SelectField#convertFrom(Function)}. */ - fun mapping(from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?) -> U): SelectField = convertFrom(Records.mapping(from)) + fun 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 = convertFrom(Records.mapping(from)) /** * Convenience mapping calling {@link SelectField#convertFrom(Class, * Function)}. */ - fun mapping(toType: Class, from: (Int?, String?, Int?, String?, String?, Double?, String?, String?, OffsetDateTime?, String?, String?, String?) -> U): SelectField = convertFrom(toType, Records.mapping(from)) + fun mapping(toType: Class, 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 = convertFrom(toType, Records.mapping(from)) } diff --git a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/BeatmapsRecord.kt b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/BeatmapsRecord.kt index a630257..ae9d48c 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/BeatmapsRecord.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/BeatmapsRecord.kt @@ -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(Beatmaps.BEATMAPS), Record12 { +open class BeatmapsRecord private constructor() : UpdatableRecordImpl(Beatmaps.BEATMAPS), Record22 { open var beatmapId: Int? set(value): Unit = set(0, value) @@ -69,6 +69,46 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl = super.key() as Record1 // ------------------------------------------------------------------------- - // Record12 type implementation + // Record22 type implementation // ------------------------------------------------------------------------- - override fun fieldsRow(): Row12 = super.fieldsRow() as Row12 - override fun valuesRow(): Row12 = super.valuesRow() as Row12 + override fun fieldsRow(): Row22 = super.fieldsRow() as Row22 + override fun valuesRow(): Row22 = super.valuesRow() as Row22 override fun field1(): Field = Beatmaps.BEATMAPS.BEATMAP_ID override fun field2(): Field = Beatmaps.BEATMAPS.ARTIST override fun field3(): Field = Beatmaps.BEATMAPS.BEATMAPSET_ID @@ -93,6 +133,16 @@ open class BeatmapsRecord private constructor() : UpdatableRecordImpl = Beatmaps.BEATMAPS.LAST_REPLAY_CHECK override fun field11(): Field = Beatmaps.BEATMAPS.BEATMAP_FILE override fun field12(): Field = Beatmaps.BEATMAPS.BEATMAP_HASH + override fun field13(): Field = Beatmaps.BEATMAPS.TOTAL_LENGTH + override fun field14(): Field = Beatmaps.BEATMAPS.BPM + override fun field15(): Field = Beatmaps.BEATMAPS.ACCURACY + override fun field16(): Field = Beatmaps.BEATMAPS.AR + override fun field17(): Field = Beatmaps.BEATMAPS.CS + override fun field18(): Field = Beatmaps.BEATMAPS.DRAIN + override fun field19(): Field = Beatmaps.BEATMAPS.COUNT_CIRCLES + override fun field20(): Field = Beatmaps.BEATMAPS.COUNT_SLIDERS + override fun field21(): Field = Beatmaps.BEATMAPS.COUNT_SPINNERS + override fun field22(): Field = 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, val rank: String, diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/UploadReplayController.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/UploadReplayController.kt index 03aac9b..eb62822 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/UploadReplayController.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/UploadReplayController.kt @@ -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() } diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/BeatmapService.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/BeatmapService.kt index 3b2c1ea..deea7d8 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/BeatmapService.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/BeatmapService.kt @@ -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 diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/ScoreService.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/ScoreService.kt index 9dad326..7358f53 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/ScoreService.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/ScoreService.kt @@ -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), diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApiModels.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApiModels.kt index 750d8d4..095a3b4 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApiModels.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApiModels.kt @@ -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? + val beatmaps: List?, ) @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 diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt index 4c08617..c3b8908 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/scheduler/ImportScores.kt @@ -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++ } diff --git a/nise-backend/src/main/resources/db/migration/V0.0.1.030__alter_beatmaps.sql b/nise-backend/src/main/resources/db/migration/V0.0.1.030__alter_beatmaps.sql new file mode 100644 index 0000000..81ade78 --- /dev/null +++ b/nise-backend/src/main/resources/db/migration/V0.0.1.030__alter_beatmaps.sql @@ -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; \ No newline at end of file diff --git a/nise-frontend/src/app/replays.ts b/nise-frontend/src/app/replays.ts index d0528d8..689876e 100644 --- a/nise-frontend/src/app/replays.ts +++ b/nise-frontend/src/app/replays.ts @@ -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; diff --git a/nise-frontend/src/app/view-score/view-score.component.html b/nise-frontend/src/app/view-score/view-score.component.html index 27ea2e8..03915c0 100644 --- a/nise-frontend/src/app/view-score/view-score.component.html +++ b/nise-frontend/src/app/view-score/view-score.component.html @@ -60,11 +60,65 @@
-
+

{{ this.replayData.beatmap_title }} by {{ this.replayData.beatmap_artist }}

★{{ this.replayData.beatmap_star_rating | number: '1.0-2' }} {{ this.replayData.beatmap_version }} + +
+
+ Length + {{ printTotalLength(this.replayData.beatmap_total_length) }} +
+
+ BPM + {{ this.replayData.beatmap_bpm | number: '1.0-1' }} +
+
+ Circles + {{ this.replayData.beatmap_count_circles }} +
+
+ Sliders + {{ this.replayData.beatmap_count_sliders }} +
+
+ Spinners + {{ this.replayData.beatmap_count_spinners }} +
+
+ + + + + + + + + + + + + + + + + + + + + +
Circle Size{{ this.replayData.beatmap_cs | number: '1.0-1' }} + +
HP Drain{{ this.replayData.beatmap_drain | number: '1.0-1' }} + +
Accuracy{{ this.replayData.beatmap_accuracy | number: '1.0-1' }} + +
Approach Rate{{ this.replayData.beatmap_ar | number: '1.0-1' }} + +
+
diff --git a/nise-frontend/src/app/view-score/view-score.component.ts b/nise-frontend/src/app/view-score/view-score.component.ts index 2f222ff..3a1e0fa 100644 --- a/nise-frontend/src/app/view-score/view-score.component.ts +++ b/nise-frontend/src/app/view-score/view-score.component.ts @@ -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 ""; diff --git a/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.css b/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.css new file mode 100644 index 0000000..e69de29 diff --git a/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.html b/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.html new file mode 100644 index 0000000..e0c9c68 --- /dev/null +++ b/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.ts b/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.ts new file mode 100644 index 0000000..0584a43 --- /dev/null +++ b/nise-frontend/src/corelib/components/cute-progressbar/cute-progressbar.component.ts @@ -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); + } + +}