fix(daily-challenge): fix don't calculate user's statistics
This commit is contained in:
@@ -138,8 +138,8 @@ async def process_daily_challenge_top():
|
||||
)
|
||||
)
|
||||
).first()
|
||||
if room is None:
|
||||
return
|
||||
participated_users = []
|
||||
if room is not None:
|
||||
scores = (
|
||||
await session.exec(
|
||||
select(PlaylistBestScore)
|
||||
@@ -153,11 +153,10 @@ async def process_daily_challenge_top():
|
||||
).all()
|
||||
total_score_count = len(scores)
|
||||
s = []
|
||||
participated_users = []
|
||||
for i, score in enumerate(scores):
|
||||
stats = await session.get(DailyChallengeStats, score.user_id)
|
||||
if stats is None: # not execute
|
||||
return
|
||||
continue
|
||||
if stats.last_update is None or stats.last_update.replace(tzinfo=UTC).date() != now.date():
|
||||
if total_score_count < 10 or ceil(i + 1 / total_score_count) <= 0.1:
|
||||
stats.top_10p_placements += 1
|
||||
@@ -173,7 +172,7 @@ async def process_daily_challenge_top():
|
||||
for id in user_ids:
|
||||
stats = await session.get(DailyChallengeStats, id)
|
||||
if stats is None: # not execute
|
||||
return
|
||||
continue
|
||||
stats.daily_streak_current = 0
|
||||
if stats.last_weekly_streak and not are_same_weeks(
|
||||
stats.last_weekly_streak.replace(tzinfo=UTC), now - timedelta(days=7)
|
||||
|
||||
Reference in New Issue
Block a user