Skip to content

Commit 885710b

Browse files
authored
Update update_readme.py
1 parent a7f545c commit 885710b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

โ€Župdate_readme.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ def get_data(user_repo):
2525
commit_times = []
2626
links = []
2727

28+
seen_problems = set() # ์ด๋ฏธ ๋ณธ ๋ฌธ์ œ๋ฅผ ์ถ”์ ํ•  set
29+
2830
# ํŒŒ์ผ ๊ฒฝ๋กœ์—์„œ ์‚ฌ์ดํŠธ, ๋‚œ์ด๋„, ๋ฌธ์ œ๋ฒˆํ˜ธ/์ด๋ฆ„ ์ถ”์ถœ
2931
for item in response_data:
3032
path_parts = item['path'].split('/')
3133
if len(path_parts) >= 3:
3234
site = path_parts[0]
3335
difficulty = path_parts[1]
3436
problem = path_parts[2] # ๋ฌธ์ œ ์ด๋ฆ„ ์ „์ฒด(ํ™•์žฅ์ž ํฌํ•จ) ๊ฐ€์ ธ์˜ค๊ธฐ
37+
# ์ด๋ฏธ ๋ณธ ๋ฌธ์ œ๋Š” ๊ฑด๋„ˆ๋œ€
38+
problem_key = (site, difficulty, problem)
39+
if problem_key in seen_problems:
40+
continue # ์ค‘๋ณต๋œ ๋ฌธ์ œ๋Š” ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์Œ
41+
seen_problems.add(problem_key)
42+
3543
sites.append(site)
3644
difficulties.append(difficulty)
3745
problems.append(problem)
@@ -46,8 +54,11 @@ def get_data(user_repo):
4654
else:
4755
commit_times.append(current_time) # ์ปค๋ฐ‹์ด ์—†์œผ๋ฉด ํ˜„์žฌ ์‹œ๊ฐ„ ์‚ฌ์šฉ
4856

49-
# ๊ฐ ๋ฌธ์ œ์— ๋Œ€ํ•œ ๋งํฌ ์ถ”๊ฐ€
50-
links.append(f"https://github.com/{user_repo}/blob/main/{item['path']}")
57+
# README.md ๋งํฌ๋งŒ ์ถ”์ถœ
58+
if "README.md" in item['path']:
59+
links.add(f"https://github.com/{user_repo}/blob/main/{item['path']}")
60+
else:
61+
links.add(f"https://github.com/{user_repo}/blob/main/{item['path']}") # ๋‹ค๋ฅธ ํŒŒ์ผ์ด ์žˆ๋‹ค๋ฉด ๊ทธ๋Œ€๋กœ ์ถ”๊ฐ€
5162

5263
return sites, difficulties, problems, commit_times, links
5364

0 commit comments

Comments
ย (0)