update for django6

This commit is contained in:
2026-05-09 05:57:30 -06:00
parent b297eb5475
commit e4e8b7759d
12 changed files with 284 additions and 69 deletions

View File

@@ -118,11 +118,11 @@ class ProblemSetBadge(models.Model):
def _is_eligible(self, progress):
"""判断用户进度是否满足该徽章条件(纯逻辑,不查数据库)"""
if self.condition_type == "all_problems":
if self.condition_type == BadgeConditionType.ALL_PROBLEMS:
return progress.completed_problems_count == progress.total_problems_count
if self.condition_type == "problem_count":
if self.condition_type == BadgeConditionType.PROBLEM_COUNT:
return progress.completed_problems_count >= self.condition_value
if self.condition_type == "score":
if self.condition_type == BadgeConditionType.SCORE:
return progress.total_score >= self.condition_value
return False