From 5329b13d2320d230d4ae3931df37e37bb0e72578 Mon Sep 17 00:00:00 2001 From: ymin431 Date: Mon, 7 Sep 2026 17:21:41 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#766=20=EB=8F=99=EC=9D=BC=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EC=B6=9C=20=EC=8B=9C?= =?UTF-8?q?=20=EC=9E=94=EB=94=94=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/profile/views/oj.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/profile/views/oj.py b/backend/profile/views/oj.py index 3625a1df..019b44c4 100644 --- a/backend/profile/views/oj.py +++ b/backend/profile/views/oj.py @@ -193,16 +193,19 @@ def get(self, request): .filter( user_id=user.id, result=JudgeStatus.ACCEPTED, - create_time__gte=start_datetime, - create_time__lt=end_datetime, ) .order_by("create_time") - .values_list("create_time", flat=True) + .values_list("problem_id", "create_time") ) + solved_problem_ids = set() count_by_date = {} - for create_time in submissions: + for problem_id, create_time in submissions: + if problem_id in solved_problem_ids: + continue + solved_problem_ids.add(problem_id) activity_date = get_activity_service_date(create_time, current_timezone) - count_by_date[activity_date] = count_by_date.get(activity_date, 0) + 1 + if start_date <= activity_date <= end_date: + count_by_date[activity_date] = count_by_date.get(activity_date, 0) + 1 current_streak, longest_streak = calculate_activity_streaks(start_date, end_date, count_by_date) activity_days = [] From 232508e894d0c5235c1973e8e3be7ca67e90008e Mon Sep 17 00:00:00 2001 From: ymin431 Date: Tue, 8 Sep 2026 01:19:40 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=EC=A0=9C=EC=B6=9C=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=EB=82=A0=EC=A7=9C?= =?UTF-8?q?=20=ED=95=84=ED=84=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/profile/views/oj.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/profile/views/oj.py b/backend/profile/views/oj.py index 019b44c4..81486202 100644 --- a/backend/profile/views/oj.py +++ b/backend/profile/views/oj.py @@ -193,6 +193,8 @@ def get(self, request): .filter( user_id=user.id, result=JudgeStatus.ACCEPTED, + create_time__gte=start_datetime, + create_time__lt=end_datetime, ) .order_by("create_time") .values_list("problem_id", "create_time") @@ -204,8 +206,7 @@ def get(self, request): continue solved_problem_ids.add(problem_id) activity_date = get_activity_service_date(create_time, current_timezone) - if start_date <= activity_date <= end_date: - count_by_date[activity_date] = count_by_date.get(activity_date, 0) + 1 + count_by_date[activity_date] = count_by_date.get(activity_date, 0) + 1 current_streak, longest_streak = calculate_activity_streaks(start_date, end_date, count_by_date) activity_days = []