fix(spectator): don't save replay for passed score
This commit is contained in:
@@ -296,19 +296,18 @@ class SpectatorHub(Hub[StoreClientState]):
|
|||||||
score_record.id,
|
score_record.id,
|
||||||
)
|
)
|
||||||
# save replay
|
# save replay
|
||||||
if store.state.state == SpectatedUserState.Passed:
|
score_record.has_replay = True
|
||||||
score_record.has_replay = True
|
await session.commit()
|
||||||
await session.commit()
|
await session.refresh(score_record)
|
||||||
await session.refresh(score_record)
|
save_replay(
|
||||||
save_replay(
|
ruleset_id=store.ruleset_id,
|
||||||
ruleset_id=store.ruleset_id,
|
md5=store.checksum,
|
||||||
md5=store.checksum,
|
username=store.score.score_info.user.name,
|
||||||
username=store.score.score_info.user.name,
|
score=score_record,
|
||||||
score=score_record,
|
statistics=store.score.score_info.statistics,
|
||||||
statistics=store.score.score_info.statistics,
|
maximum_statistics=store.score.score_info.maximum_statistics,
|
||||||
maximum_statistics=store.score.score_info.maximum_statistics,
|
frames=store.score.replay_frames,
|
||||||
frames=store.score.replay_frames,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
async def _end_session(self, user_id: int, state: SpectatorState) -> None:
|
async def _end_session(self, user_id: int, state: SpectatorState) -> None:
|
||||||
if state.state == SpectatedUserState.Playing:
|
if state.state == SpectatedUserState.Playing:
|
||||||
|
|||||||
Reference in New Issue
Block a user