Skip to content

Commit 9d30ec3

Browse files
authored
Merge pull request #13 from MishkatIT/copilot/fix-readme-update-issue
Fix README "Updated On" column regex - remove hardcoded placeholder
2 parents 3de1d0e + db6f43c commit 9d30ec3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

update_readme.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ def update_readme(stats, last_known_info=None, update_source=None):
281281
readme_content = re.sub(progress_pattern, progress_replacement, readme_content, flags=re.DOTALL)
282282

283283
# Update the "Updated On" column for each platform
284-
updated_on_pattern = rf'({platform_name}.*?<td align="center">\d+.*?<td align="center">\d+\.\d+%.*?<td align="center">).*?;sljdkf.*?</td>'
284+
# Pattern matches: platform name -> progress badge with specific percentage -> updated on cell
285+
# Using the specific percentage makes the pattern more precise and ensures we update the correct row
286+
updated_on_pattern = rf'({platform_name}.*?Progress-{percentage}%25.*?<td align="center">).*?</td>'
285287
updated_on_replacement = rf'\g<1>{date_str}</td>'
286288
readme_content = re.sub(updated_on_pattern, updated_on_replacement, readme_content, flags=re.DOTALL)
287289

@@ -292,6 +294,15 @@ def update_readme(stats, last_known_info=None, update_source=None):
292294
readme_content
293295
)
294296

297+
# Update the "Updated On" column in the footer (total row)
298+
# Pattern is flexible to handle potential rounding differences in percentage
299+
readme_content = re.sub(
300+
r'(TOTAL.*?<td align="center"><strong>\d+(?:\.\d+)?%</strong></td>\s*<td align="center">).*?</td>',
301+
rf'\g<1>{current_date}</td>',
302+
readme_content,
303+
flags=re.DOTALL
304+
)
305+
295306
# Update key highlights if Codeforces is the top platform
296307
if isinstance(effective_counts.get('Codeforces'), int):
297308
cf_count = effective_counts['Codeforces']

0 commit comments

Comments
 (0)