feat(room): use participated user count as participant count for playlist room
This commit is contained in:
@@ -59,9 +59,10 @@ class ItemAttemptsCount(AsyncAttrs, ItemAttemptsCountBase, table=True):
|
||||
self.attempts = sum(score.attempts for score in playlist_scores)
|
||||
self.total_score = sum(score.total_score for score in playlist_scores)
|
||||
self.pp = sum(score.score.pp for score in playlist_scores)
|
||||
self.completed = len([score for score in playlist_scores if score.score.passed])
|
||||
passed_scores = [score for score in playlist_scores if score.score.passed]
|
||||
self.completed = len(passed_scores)
|
||||
self.accuracy = (
|
||||
sum(score.score.accuracy for score in playlist_scores) / self.completed if self.completed > 0 else 0.0
|
||||
sum(score.score.accuracy for score in passed_scores) / self.completed if self.completed > 0 else 0.0
|
||||
)
|
||||
await session.commit()
|
||||
await session.refresh(self)
|
||||
|
||||
Reference in New Issue
Block a user