Skip to content

Commit 40d1a8a

Browse files
committed
Update GitHub Actions workflow to run daily and add random delay; modify README update logic for improved accuracy
1 parent 1fbd55b commit 40d1a8a

3 files changed

Lines changed: 66 additions & 45 deletions

File tree

.github/workflows/update-stats.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Update Problem Solving Statistics
22

33
on:
44
schedule:
5-
# Run every week on Sunday at 00:00 UTC
6-
- cron: '0 0 * * 0'
5+
# Run every day at 11:50 BDT (05:50 UTC), then add random delay
6+
- cron: '50 5 * * *'
77
workflow_dispatch: # Allow manual trigger
88

99
jobs:
@@ -13,6 +13,12 @@ jobs:
1313
contents: write # Required to push changes to repository
1414

1515
steps:
16+
- name: Random delay (0-9 minutes)
17+
run: |
18+
RANDOM_SECONDS=$((RANDOM % 540))
19+
echo "Waiting for $RANDOM_SECONDS seconds to randomize execution time..."
20+
sleep $RANDOM_SECONDS
21+
1622
- name: Checkout repository
1723
uses: actions/checkout@v4
1824

README.md

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Platforms](https://img.shields.io/badge/Platforms-12-orange?style=for-the-badge)](https://github.com/MishkatIT/ProblemSolvingStats)
88

99
<!-- UPDATE_METADATA_START -->
10-
<p align="center"><strong>Updated:</strong> 15 January 2026 • Manual</p>
10+
<p align="center"><strong>Updated:</strong> 15 January 2026 • Automatic</p>
1111
<!-- UPDATE_METADATA_END -->
1212

1313
### 💻 Competitive Programming Journey
@@ -30,92 +30,105 @@
3030
<th>✅ Solved</th>
3131
<th>📈 Progress</th>
3232
<th>📅 Updated On</th>
33+
<th>🔄 Mode</th>
3334
</tr>
3435
</thead>
3536
<tbody>
3637
<tr>
37-
<td><strong>🔴 Codeforces</strong></td>
38+
<td><img src="https://cdn.iconscout.com/icon/free/png-16/codeforces-3628695-3029920.png" width="16" height="16" alt="Codeforces"/> <strong>Codeforces</strong></td>
3839
<td><a href="https://codeforces.com/profile/MishkatIT">MishkatIT</a></td>
3940
<td align="center"><strong>2596</strong></td>
4041
<td><img src="https://img.shields.io/badge/Progress-68.3%25-red?style=flat-square" alt="Codeforces Progress"/></td>
41-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
42+
<td align="left">15 January 2026</td>
43+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
4244
</tr>
4345
<tr>
44-
<td><strong>🟢 LeetCode</strong></td>
46+
<td><img src="https://leetcode.com/favicon-16x16.png" width="16" height="16" alt="LeetCode"/> <strong>LeetCode</strong></td>
4547
<td><a href="https://leetcode.com/MishkatIT/">MishkatIT</a></td>
4648
<td align="center"><strong>412</strong></td>
4749
<td><img src="https://img.shields.io/badge/Progress-10.8%25-yellow?style=flat-square" alt="LeetCode Progress"/></td>
48-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
50+
<td align="left">15 January 2026</td>
51+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
4952
</tr>
5053
<tr>
51-
<td><strong>🟣 Vjudge</strong></td>
54+
<td><img src="https://vjudge.net/favicon.ico" width="16" height="16" alt="Vjudge"/> <strong>Vjudge</strong></td>
5255
<td><a href="https://vjudge.net/user/MishkatIT">MishkatIT</a></td>
5356
<td align="center"><strong>347</strong></td>
5457
<td><img src="https://img.shields.io/badge/Progress-9.1%25-blueviolet?style=flat-square" alt="Vjudge Progress"/></td>
55-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
58+
<td align="left">15 January 2026</td>
59+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
5660
</tr>
5761
<tr>
58-
<td><strong>🟠 AtCoder</strong></td>
62+
<td><img src="https://atcoder.jp/favicon.ico" width="16" height="16" alt="AtCoder"/> <strong>AtCoder</strong></td>
5963
<td><a href="https://atcoder.jp/users/MishkatIT">MishkatIT</a></td>
6064
<td align="center"><strong>157</strong></td>
6165
<td><img src="https://img.shields.io/badge/Progress-4.1%25-orange?style=flat-square" alt="AtCoder Progress"/></td>
62-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
66+
<td align="left">15 January 2026</td>
67+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
6368
</tr>
6469
<tr>
65-
<td><strong>🟤 CodeChef</strong></td>
70+
<td><img src="https://cdn.codechef.com/sites/all/themes/abessive/cc-logo.png" width="16" height="16" alt="CodeChef"/> <strong>CodeChef</strong></td>
6671
<td><a href="https://www.codechef.com/users/MishkatIT">MishkatIT</a></td>
6772
<td align="center"><strong>124</strong></td>
6873
<td><img src="https://img.shields.io/badge/Progress-3.3%25-brown?style=flat-square" alt="CodeChef Progress"/></td>
69-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
74+
<td align="left">15 January 2026</td>
75+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
7076
</tr>
7177
<tr>
72-
<td><strong>⚪ CSES</strong></td>
78+
<td><img src="https://www.google.com/s2/favicons?domain=cses.fi&sz=16" width="16" height="16" alt="CSES"/> <strong>CSES</strong></td>
7379
<td><a href="https://cses.fi/user/165802/">MishkatIT</a></td>
7480
<td align="center"><strong>66</strong></td>
7581
<td><img src="https://img.shields.io/badge/Progress-1.7%25-lightgray?style=flat-square" alt="CSES Progress"/></td>
76-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
82+
<td align="left">15 January 2026</td>
83+
<td align="center"><img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
7784
</tr>
7885
<tr>
79-
<td><strong>🔵 Toph</strong></td>
86+
<td><img src="https://toph.co/favicon.ico" width="16" height="16" alt="Toph"/> <strong>Toph</strong></td>
8087
<td><a href="https://toph.co/u/MishkatIT">MishkatIT</a></td>
8188
<td align="center"><strong>36</strong></td>
8289
<td><img src="https://img.shields.io/badge/Progress-0.9%25-blue?style=flat-square" alt="Toph Progress"/></td>
83-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
90+
<td align="left">15 January 2026</td>
91+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
8492
</tr>
8593
<tr>
86-
<td><strong>🟡 LightOJ</strong></td>
94+
<td><img src="https://lightoj.com/favicon.ico" width="16" height="16" alt="LightOJ"/> <strong>LightOJ</strong></td>
8795
<td><a href="https://lightoj.com/user/mishkatit">MishkatIT</a></td>
8896
<td align="center"><strong>31</strong></td>
8997
<td><img src="https://img.shields.io/badge/Progress-0.8%25-yellow?style=flat-square" alt="LightOJ Progress"/></td>
90-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
98+
<td align="left">15 January 2026</td>
99+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
91100
</tr>
92101
<tr>
93-
<td><strong>🟩 SPOJ</strong></td>
102+
<td><img src="https://www.spoj.com/favicon.ico" width="16" height="16" alt="SPOJ"/> <strong>SPOJ</strong></td>
94103
<td><a href="https://www.spoj.com/users/mishkatit/">MishkatIT</a></td>
95104
<td align="center"><strong>18</strong></td>
96105
<td><img src="https://img.shields.io/badge/Progress-0.5%25-green?style=flat-square" alt="SPOJ Progress"/></td>
97-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
106+
<td align="left">15 January 2026</td>
107+
<td align="center"><img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
98108
</tr>
99109
<tr>
100-
<td><strong>💚 HackerRank</strong></td>
110+
<td><img src="https://hrcdn.net/fcore/assets/favicon-ddc852f75a.png" width="16" height="16" alt="HackerRank"/> <strong>HackerRank</strong></td>
101111
<td><a href="https://www.hackerrank.com/MishkatIT">MishkatIT</a></td>
102112
<td align="center"><strong>7</strong></td>
103113
<td><img src="https://img.shields.io/badge/Progress-0.2%25-brightgreen?style=flat-square" alt="HackerRank Progress"/></td>
104-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
114+
<td align="left">15 January 2026</td>
115+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
105116
</tr>
106117
<tr>
107-
<td><strong>🔷 UVa</strong></td>
118+
<td><img src="https://www.google.com/s2/favicons?domain=onlinejudge.org&sz=16" width="16" height="16" alt="UVa"/> <strong>UVa</strong></td>
108119
<td><a href="https://uhunt.onlinejudge.org/id/1615470">MishkatIT</a></td>
109120
<td align="center"><strong>6</strong></td>
110121
<td><img src="https://img.shields.io/badge/Progress-0.2%25-blue?style=flat-square" alt="UVa Progress"/></td>
111-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
122+
<td align="left">15 January 2026</td>
123+
<td align="center"><img src="https://img.shields.io/badge/Automatic-green?style=flat" alt="Automatic"/></td>
112124
</tr>
113125
<tr>
114-
<td><strong>🌐 HackerEarth</strong></td>
126+
<td><img src="https://www.google.com/s2/favicons?domain=hackerearth.com&sz=16" width="16" height="16" alt="HackerEarth"/> <strong>HackerEarth</strong></td>
115127
<td><a href="https://www.hackerearth.com/@MishkatIT">MishkatIT</a></td>
116128
<td align="center"><strong>2</strong></td>
117129
<td><img src="https://img.shields.io/badge/Progress-0.1%25-blue?style=flat-square" alt="HackerEarth Progress"/></td>
118-
<td align="left">15 January 2026 <img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
130+
<td align="left">15 January 2026</td>
131+
<td align="center"><img src="https://img.shields.io/badge/Manual-orange?style=flat" alt="Manual"/></td>
119132
</tr>
120133
</tbody>
121134
<tfoot>
@@ -124,6 +137,7 @@
124137
<td align="center"><strong style="font-size: 1.2em;">3802</strong></td>
125138
<td align="center"><strong>100%</strong></td>
126139
<td align="center">15 January 2026</td>
140+
<td></td>
127141
</tr>
128142
</tfoot>
129143
</table>
@@ -148,7 +162,7 @@
148162
This repository tracks problem-solving statistics using a hybrid approach:
149163

150164
### Automatic Updates (GitHub Actions)
151-
- Runs weekly on Sundays at 00:00 UTC
165+
- Runs daily between 11:50-11:59 AM BDT (randomized)
152166
- Automatically fetches statistics from platforms with working APIs
153167
- Failed platforms fall back to last known values with date stamps
154168
- Updates are pushed automatically to the repository

update_readme.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,20 @@ def update_readme(stats, last_known_info=None, update_source=None):
179179

180180
# Platform patterns for updating counts in README table
181181
# Match everything between <strong> and </strong> tags with 3 capture groups
182+
# Updated to match favicon structure instead of emojis
182183
PLATFORM_PATTERNS = {
183-
'Codeforces': r'(🔴\s+Codeforces.*?<td align="center"><strong>)(.*?)(</strong>)',
184-
'LeetCode': r'(🟢\s+LeetCode.*?<td align="center"><strong>)(.*?)(</strong>)',
185-
'Vjudge': r'(🟣\s+Vjudge.*?<td align="center"><strong>)(.*?)(</strong>)',
186-
'AtCoder': r'(🟠\s+AtCoder.*?<td align="center"><strong>)(.*?)(</strong>)',
187-
'CodeChef': r'(🟤\s+CodeChef.*?<td align="center"><strong>)(.*?)(</strong>)',
188-
'CSES': r'(⚪\s+CSES.*?<td align="center"><strong>)(.*?)(</strong>)',
189-
'Toph': r'(🔵\s+Toph.*?<td align="center"><strong>)(.*?)(</strong>)',
190-
'LightOJ': r'(🟡\s+LightOJ.*?<td align="center"><strong>)(.*?)(</strong>)',
191-
'SPOJ': r'(🟩\s+SPOJ.*?<td align="center"><strong>)(.*?)(</strong>)',
192-
'HackerRank': r'(💚\s+HackerRank.*?<td align="center"><strong>)(.*?)(</strong>)',
193-
'UVa': r'(🔷\s+UVa.*?<td align="center"><strong>)(.*?)(</strong>)',
194-
'HackerEarth': r'(🌐\s+HackerEarth.*?<td align="center"><strong>)(.*?)(</strong>)',
184+
'Codeforces': r'(<strong>Codeforces</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
185+
'LeetCode': r'(<strong>LeetCode</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
186+
'Vjudge': r'(<strong>Vjudge</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
187+
'AtCoder': r'(<strong>AtCoder</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
188+
'CodeChef': r'(<strong>CodeChef</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
189+
'CSES': r'(<strong>CSES</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
190+
'Toph': r'(<strong>Toph</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
191+
'LightOJ': r'(<strong>LightOJ</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
192+
'SPOJ': r'(<strong>SPOJ</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
193+
'HackerRank': r'(<strong>HackerRank</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
194+
'UVa': r'(<strong>UVa</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
195+
'HackerEarth': r'(<strong>HackerEarth</strong>.*?<td align="center"><strong>)(.*?)(</strong>)',
195196
}
196197

197198
# Determine which platforms were freshly updated vs using last known
@@ -292,11 +293,11 @@ def update_readme(stats, last_known_info=None, update_source=None):
292293
progress_replacement = rf'\g<1>{percentage}%25'
293294
readme_content = re.sub(progress_pattern, progress_replacement, readme_content, flags=re.DOTALL)
294295

295-
# Update the "Updated On" column for each platform
296-
# Ensure the shield badge is replaced instead of adding a new one
297-
updated_on_pattern = rf'({platform_name}.*?Progress-{percentage}%25.*?<td align="left">).*?<img src="https://img.shields.io/badge/.*?".*?</td>'
298-
updated_on_replacement = rf'\g<1>{date_str} <img src="https://img.shields.io/badge/{mode_display}-{mode_color}?style=flat" alt="{mode_display}"/></td>'
299-
readme_content = re.sub(updated_on_pattern, updated_on_replacement, readme_content, flags=re.DOTALL)
296+
# Update the "Updated On" column and "Mode" column for each platform
297+
# Pattern matches: Progress badge -> Updated On date -> Mode badge
298+
date_and_mode_pattern = rf'({platform_name}.*?Progress-{percentage}%25.*?<td align="left">)[^<]*</td>\s*<td align="center">.*?</td>'
299+
date_and_mode_replacement = rf'\g<1>{date_str}</td>\n <td align="center"><img src="https://img.shields.io/badge/{mode_display}-{mode_color}?style=flat" alt="{mode_display}"/></td>'
300+
readme_content = re.sub(date_and_mode_pattern, date_and_mode_replacement, readme_content, flags=re.DOTALL)
300301

301302
# Update total in footer
302303
readme_content = re.sub(

0 commit comments

Comments
 (0)