fix(statistics): add length of beatmap to PT instead of ended_at - started_at
This commit is contained in:
@@ -509,7 +509,7 @@ async def get_user_best_pp(
|
|||||||
|
|
||||||
|
|
||||||
async def process_user(
|
async def process_user(
|
||||||
session: AsyncSession, user: User, score: Score, ranked: bool = False
|
session: AsyncSession, user: User, score: Score, length: int, ranked: bool = False
|
||||||
):
|
):
|
||||||
assert user.id
|
assert user.id
|
||||||
assert score.id
|
assert score.id
|
||||||
@@ -613,7 +613,7 @@ async def process_user(
|
|||||||
)
|
)
|
||||||
statistics.play_count += 1
|
statistics.play_count += 1
|
||||||
mouthly_playcount.playcount += 1
|
mouthly_playcount.playcount += 1
|
||||||
statistics.play_time += int((score.ended_at - score.started_at).total_seconds())
|
statistics.play_time += length
|
||||||
statistics.count_100 += score.n100 + score.nkatu
|
statistics.count_100 += score.n100 + score.nkatu
|
||||||
statistics.count_300 += score.n300 + score.ngeki
|
statistics.count_300 += score.n300 + score.ngeki
|
||||||
statistics.count_50 += score.n50
|
statistics.count_50 += score.n50
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ async def submit_score(
|
|||||||
ranked = (
|
ranked = (
|
||||||
db_beatmap.beatmap_status.has_pp() | settings.enable_all_beatmap_leaderboard
|
db_beatmap.beatmap_status.has_pp() | settings.enable_all_beatmap_leaderboard
|
||||||
)
|
)
|
||||||
|
beatmap_length = db_beatmap.total_length
|
||||||
score = await process_score(
|
score = await process_score(
|
||||||
current_user,
|
current_user,
|
||||||
beatmap,
|
beatmap,
|
||||||
@@ -110,7 +111,7 @@ async def submit_score(
|
|||||||
await db.refresh(current_user)
|
await db.refresh(current_user)
|
||||||
score_id = score.id
|
score_id = score.id
|
||||||
score_token.score_id = score_id
|
score_token.score_id = score_id
|
||||||
await process_user(db, current_user, score, ranked)
|
await process_user(db, current_user, score, beatmap_length, ranked)
|
||||||
score = (await db.exec(select(Score).where(Score.id == score_id))).first()
|
score = (await db.exec(select(Score).where(Score.id == score_id))).first()
|
||||||
assert score is not None
|
assert score is not None
|
||||||
return await ScoreResp.from_db(db, score)
|
return await ScoreResp.from_db(db, score)
|
||||||
|
|||||||
Reference in New Issue
Block a user