Skip to content

Commit 33336ea

Browse files
authored
Update update_scoreboard.py
1 parent c931900 commit 33336ea

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

_MonthlyChallenges/update_scoreboard.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,25 @@ def initialize_user():
2121
}
2222

2323
def main():
24-
# 현재 달 문자열
25-
current_month = datetime.now().strftime("%Y-%m")
24+
# 1. pr_data.json 파일 로드
25+
print("[Step 3] Loading PR data file...")
26+
if not os.path.exists(PR_DATA_FILE):
27+
print(f"[Step 3] PR data file not found: {PR_DATA_FILE}")
28+
exit(1)
2629

30+
with open(PR_DATA_FILE, 'r', encoding='utf-8') as f:
31+
pr_data = json.load(f)
32+
33+
print(f"[Step 3] Loaded PR data: {pr_data!r}")
34+
35+
# 현재 달 문자열
36+
for entry in pr_data:
37+
print(f"entry: {entry}")
38+
current_month = entry["created_at"]
39+
print(f"current_month: {current_month})
40+
current_month = current_month.strftime("%Y-%m")
41+
print(f"current_month: {current_month})
42+
2743
# 1. 기존 스코어보드 로드 (없으면 빈 dict로 초기화)
2844
print("[Step 1] Loading scoreboard file...")
2945
if os.path.exists(SCOREBOARD_FILE):
@@ -59,17 +75,6 @@ def main():
5975

6076
users = scoreboard["users"]
6177

62-
# 3. pr_data.json 파일 로드
63-
print("[Step 3] Loading PR data file...")
64-
if not os.path.exists(PR_DATA_FILE):
65-
print(f"[Step 3] PR data file not found: {PR_DATA_FILE}")
66-
exit(1)
67-
68-
with open(PR_DATA_FILE, 'r', encoding='utf-8') as f:
69-
pr_data = json.load(f)
70-
71-
print(f"[Step 3] Loaded PR data: {pr_data!r}")
72-
7378
# 4. pr_data의 각 항목을 순회하며 사용자별 스코어보드 업데이트
7479
print("[Step 4] Processing PR data entries...")
7580
for entry in pr_data:

0 commit comments

Comments
 (0)