Skip to content

Commit a2ec877

Browse files
committed
πŸš€ Add complete automatic tracking system
✨ Features added: - Live GitHub streak calendar & activity graph - Dynamic badges (problems solved, success rate, current day) - GitHub Actions workflow for auto-updates - Node.js progress tracker script - Real-time stats.json generation - Manual update script (update-progress.sh) - Complete documentation (tracking-setup.md) 🎯 Benefits: - Zero manual tracking required - Professional GitHub profile showcase - Real-time progress visualization - Job interview ready consistency proof πŸ“Š Current: Day 3/90 | 2 problems solved | 67% success rate
1 parent 5647709 commit a2ec877

File tree

7 files changed

+488
-7
lines changed

7 files changed

+488
-7
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: πŸ“Š Auto Update LeetCode Stats
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
schedule:
7+
- cron: '0 0 * * *' # Daily at midnight UTC
8+
workflow_dispatch:
9+
10+
jobs:
11+
update-stats:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: πŸ”„ Checkout Repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: πŸ“Š Count Problems Solved
21+
id: count
22+
run: |
23+
# Count .java files in Daily-contest directory
24+
PROBLEM_COUNT=$(find Daily-contest -name "*.java" 2>/dev/null | wc -l)
25+
echo "problems=$PROBLEM_COUNT" >> $GITHUB_OUTPUT
26+
27+
# Count folders (days completed)
28+
FOLDER_COUNT=$(find Daily-contest -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
29+
echo "days=$FOLDER_COUNT" >> $GITHUB_OUTPUT
30+
31+
- name: πŸ“… Calculate Challenge Progress
32+
id: progress
33+
run: |
34+
START_DATE="2025-10-01"
35+
CURRENT_DATE=$(date +%Y-%m-%d)
36+
37+
# Calculate days since start (including start date)
38+
DAYS_SINCE_START=$(( ($(date -d "$CURRENT_DATE" +%s) - $(date -d "$START_DATE" +%s)) / 86400 + 1 ))
39+
40+
# Ensure we don't go below 1 or above 90
41+
if [ $DAYS_SINCE_START -lt 1 ]; then
42+
DAYS_SINCE_START=1
43+
elif [ $DAYS_SINCE_START -gt 90 ]; then
44+
DAYS_SINCE_START=90
45+
fi
46+
47+
echo "currentDay=$DAYS_SINCE_START" >> $GITHUB_OUTPUT
48+
49+
# Calculate success rate
50+
PROBLEMS_SOLVED=${{ steps.count.outputs.problems }}
51+
if [ $DAYS_SINCE_START -gt 0 ]; then
52+
SUCCESS_RATE=$(( (PROBLEMS_SOLVED * 100) / DAYS_SINCE_START ))
53+
else
54+
SUCCESS_RATE=0
55+
fi
56+
echo "successRate=$SUCCESS_RATE" >> $GITHUB_OUTPUT
57+
58+
- name: ✨ Generate Stats JSON
59+
run: |
60+
cat > stats.json << EOF
61+
{
62+
"totalProblems": ${{ steps.count.outputs.problems }},
63+
"foldersCreated": ${{ steps.count.outputs.days }},
64+
"currentDay": ${{ steps.progress.outputs.currentDay }},
65+
"successRate": ${{ steps.progress.outputs.successRate }},
66+
"challengeStartDate": "2025-10-01",
67+
"lastUpdated": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
68+
"daysRemaining": $((90 - ${{ steps.progress.outputs.currentDay }})),
69+
"targetProblems": 90,
70+
"averageProblemsPerDay": "$(echo "scale=2; ${{ steps.count.outputs.problems }} / ${{ steps.progress.outputs.currentDay }}" | bc -l 2>/dev/null || echo "0")"
71+
}
72+
EOF
73+
74+
- name: 🎯 Create Progress Badge Data
75+
run: |
76+
PROBLEMS=${{ steps.count.outputs.problems }}
77+
DAY=${{ steps.progress.outputs.currentDay }}
78+
SUCCESS_RATE=${{ steps.progress.outputs.successRate }}
79+
80+
# Create individual badge data files
81+
echo "$PROBLEMS" > problem-count.txt
82+
echo "$DAY" > current-day.txt
83+
echo "${SUCCESS_RATE}%" > success-rate.txt
84+
85+
- name: πŸ“ Commit Updated Stats
86+
run: |
87+
git config --local user.name "github-actions[bot]"
88+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
89+
90+
git add stats.json problem-count.txt current-day.txt success-rate.txt
91+
92+
if ! git diff --staged --quiet; then
93+
git commit -m "πŸ“Š Auto-update LeetCode progress stats [Day ${{ steps.progress.outputs.currentDay }}] - ${{ steps.count.outputs.problems }} problems solved"
94+
git push
95+
else
96+
echo "No changes to commit"
97+
fi

β€ŽREADME.mdβ€Ž

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,77 @@ The focus is **discipline, algorithms, and consistency** πŸ’ͺ✨
1616

1717
---
1818

19-
## πŸ“Š Streak & Progress Tracker
19+
## πŸ“Š Live Progress Dashboard πŸš€
2020

21+
### πŸ”₯ Real-Time Challenge Stats
2122
<p align="center">
22-
<img src="https://media.giphy.com/media/QssGEmpkyEOhBCb7e1/giphy.gif" width="200" alt="Progress"/>
23+
<img src="https://img.shields.io/github/last-commit/deekshith-b48/Daily-LeetCode?style=for-the-badge&logo=github&label=Last%20Solved&color=brightgreen" alt="Last Commit"/>
24+
<img src="https://img.shields.io/github/commit-activity/w/deekshith-b48/Daily-LeetCode?style=for-the-badge&label=Weekly%20Activity&color=blue" alt="Weekly Activity"/>
2325
</p>
2426

25-
### πŸ”₯ Auto-updated Streak Heatmap
27+
<p align="center">
28+
<img src="https://img.shields.io/badge/Challenge%20Started-Oct%201,%202025-orange?style=for-the-badge" alt="Start Date"/>
29+
<img src="https://img.shields.io/badge/Target-90%20Days-red?style=for-the-badge" alt="Target"/>
30+
<img src="https://img.shields.io/badge/Status-In%20Progress-success?style=for-the-badge" alt="Status"/>
31+
</p>
32+
33+
### πŸ”₯ GitHub Streak Calendar (Auto-Updated)
34+
35+
<p align="center">
36+
<img src="https://github-readme-streak-stats.herokuapp.com/?user=deekshith-b48&theme=tokyonight&hide_border=true&date_format=j%20M%5B%20Y%5D" alt="GitHub Streak"/>
37+
</p>
38+
39+
### πŸ“ˆ Daily Activity Graph
40+
41+
<p align="center">
42+
<img src="https://github-readme-activity-graph.vercel.app/graph?username=deekshith-b48&theme=tokyo-night&hide_border=true&custom_title=LeetCode%20Journey%20Activity%20Graph" alt="Activity Graph"/>
43+
</p>
44+
45+
### πŸ“Š Problem Solving Progress
2646

2747
<p align="center">
28-
<img src="https://github-readme-streak-stats.herokuapp.com?user=deekshith-b48&theme=radical&date_format=j%20M%5B%20Y%5D" alt="GitHub Streak"/>
48+
<img src="https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.totalProblems&label=Problems%20Solved&style=for-the-badge&color=brightgreen" alt="Problems Solved"/>
49+
<img src="https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.currentDay&label=Challenge%20Day&style=for-the-badge&color=blue" alt="Current Day"/>
2950
</p>
3051

31-
> βœ… This streak calendar **auto-updates daily** using my GitHub commits.
32-
> 🟒 No need to manually edit progress logs.
52+
> βœ… **Fully Automated:** All stats update automatically with each commit!
53+
> πŸ”₯ **Zero Manual Work:** Just commit your solutions - everything else is magic!
54+
> πŸ“ˆ **Real-Time:** Stats refresh instantly when you push code!
55+
56+
---
57+
58+
## οΏ½ Detailed Progress Metrics
59+
60+
### 🎯 Challenge Statistics
61+
| Metric | Value | Target | Status |
62+
|--------|--------|---------|---------|
63+
| **Problems Solved** | ![Problems](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.totalProblems&label=Count&style=flat-square&color=brightgreen) | 90+ | 🎯 |
64+
| **Current Day** | ![Day](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.currentDay&label=Day&style=flat-square&color=blue) / 90 | 90 Days | πŸ“… |
65+
| **Success Rate** | ![Rate](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.successRate&label=Rate&suffix=%25&style=flat-square&color=orange) | 100% | πŸ“ˆ |
66+
| **Days Remaining** | ![Remaining](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/deekshith-b48/Daily-LeetCode/main/stats.json&query=$.daysRemaining&label=Remaining&style=flat-square&color=red) | 0 | ⏰ |
67+
68+
### πŸ“… Monthly Progress Calendar
69+
70+
#### October 2025 - Challenge Start πŸš€
71+
```
72+
Mon Tue Wed Thu Fri Sat Sun
73+
1 2 3 4 5 6
74+
7 8 9 10 11 12 13
75+
14 15 16 17 18 19 20
76+
21 22 23 24 25 26 27
77+
28 29 30 31
78+
```
79+
> 🟒 **Green** = Problem solved | βšͺ **Gray** = Upcoming | πŸ”΄ **Red** = Missed
80+
81+
### πŸŽͺ Quick Stats Summary
82+
- πŸ”₯ **Current Streak:** Tracked via GitHub commits
83+
- ⚑ **Average Problems/Day:** Dynamic calculation
84+
- 🎯 **Challenge Progress:** Auto-updated percentage
85+
- πŸ“Š **Last Updated:** Real-time via GitHub Actions
3386

3487
---
3588

36-
## 🚦 How to Use
89+
## �🚦 How to Use
3790

3891
πŸ”Ή **Browse folders by date** β†’ solutions organized daily.
3992
πŸ”Ή **Problem descriptions** inside file comments.

β€Žpackage.jsonβ€Ž

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "leetcode-progress-tracker",
3+
"version": "1.0.0",
4+
"description": "Automatic progress tracking for Daily LeetCode Challenge",
5+
"main": "scripts/progress-tracker.js",
6+
"scripts": {
7+
"track": "node scripts/progress-tracker.js",
8+
"save-stats": "node scripts/progress-tracker.js --save",
9+
"stats": "node scripts/progress-tracker.js --quiet"
10+
},
11+
"keywords": ["leetcode", "progress", "tracking", "automation"],
12+
"author": "deekshith-b48",
13+
"license": "MIT"
14+
}

β€Žscripts/progress-tracker.jsβ€Ž

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* πŸ“Š LeetCode Progress Counter
5+
* Automatically counts solved problems and tracks progress
6+
*/
7+
8+
const fs = require('fs');
9+
const path = require('path');
10+
11+
class LeetCodeTracker {
12+
constructor() {
13+
this.contestDir = 'Daily-contest';
14+
this.startDate = new Date('2025-10-01');
15+
this.targetDays = 90;
16+
}
17+
18+
/**
19+
* Count all solved problems (.java files)
20+
*/
21+
countProblems() {
22+
let problemCount = 0;
23+
let folderCount = 0;
24+
25+
try {
26+
if (!fs.existsSync(this.contestDir)) {
27+
console.log(`πŸ“ Creating ${this.contestDir} directory...`);
28+
fs.mkdirSync(this.contestDir);
29+
return { problems: 0, folders: 0 };
30+
}
31+
32+
const folders = fs.readdirSync(this.contestDir);
33+
34+
folders.forEach(folder => {
35+
const folderPath = path.join(this.contestDir, folder);
36+
37+
if (fs.statSync(folderPath).isDirectory()) {
38+
folderCount++;
39+
const files = fs.readdirSync(folderPath);
40+
41+
// Count .java files as solved problems
42+
const javaFiles = files.filter(file => file.endsWith('.java'));
43+
problemCount += javaFiles.length;
44+
45+
console.log(`πŸ“‚ ${folder}: ${javaFiles.length} problems`);
46+
}
47+
});
48+
49+
} catch (error) {
50+
console.error('❌ Error counting problems:', error.message);
51+
return { problems: 0, folders: 0 };
52+
}
53+
54+
return { problems: problemCount, folders: folderCount };
55+
}
56+
57+
/**
58+
* Calculate current challenge day
59+
*/
60+
getCurrentDay() {
61+
const today = new Date();
62+
const diffTime = today.getTime() - this.startDate.getTime();
63+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
64+
65+
// Ensure we stay within challenge bounds
66+
return Math.max(1, Math.min(diffDays, this.targetDays));
67+
}
68+
69+
/**
70+
* Generate comprehensive stats
71+
*/
72+
generateStats() {
73+
const { problems, folders } = this.countProblems();
74+
const currentDay = this.getCurrentDay();
75+
const successRate = currentDay > 0 ? Math.round((problems / currentDay) * 100) : 0;
76+
const daysRemaining = Math.max(0, this.targetDays - currentDay);
77+
const averageProblemsPerDay = currentDay > 0 ? (problems / currentDay).toFixed(2) : 0;
78+
79+
const stats = {
80+
totalProblems: problems,
81+
foldersCreated: folders,
82+
currentDay: currentDay,
83+
successRate: successRate,
84+
challengeStartDate: this.startDate.toISOString().split('T')[0],
85+
lastUpdated: new Date().toISOString(),
86+
daysRemaining: daysRemaining,
87+
targetProblems: this.targetDays,
88+
averageProblemsPerDay: parseFloat(averageProblemsPerDay),
89+
progressPercentage: Math.round((currentDay / this.targetDays) * 100),
90+
completionStatus: currentDay >= this.targetDays ? 'Completed' : 'In Progress'
91+
};
92+
93+
return stats;
94+
}
95+
96+
/**
97+
* Save stats to JSON file
98+
*/
99+
saveStats() {
100+
const stats = this.generateStats();
101+
102+
try {
103+
fs.writeFileSync('stats.json', JSON.stringify(stats, null, 2));
104+
console.log('βœ… Stats saved to stats.json');
105+
return stats;
106+
} catch (error) {
107+
console.error('❌ Error saving stats:', error.message);
108+
return null;
109+
}
110+
}
111+
112+
/**
113+
* Display progress summary
114+
*/
115+
displayProgress() {
116+
const stats = this.generateStats();
117+
118+
console.log('\nπŸ“Š === LeetCode Challenge Progress === πŸ“Š');
119+
console.log(`πŸ—“οΈ Challenge Day: ${stats.currentDay}/${this.targetDays}`);
120+
console.log(`βœ… Problems Solved: ${stats.totalProblems}`);
121+
console.log(`πŸ“ Days Documented: ${stats.foldersCreated}`);
122+
console.log(`πŸ“ˆ Success Rate: ${stats.successRate}%`);
123+
console.log(`⚑ Average Problems/Day: ${stats.averageProblemsPerDay}`);
124+
console.log(`⏰ Days Remaining: ${stats.daysRemaining}`);
125+
console.log(`🎯 Progress: ${stats.progressPercentage}% Complete`);
126+
console.log(`πŸ“Š Status: ${stats.completionStatus}`);
127+
128+
// Progress bar
129+
const progressBar = 'β–ˆ'.repeat(Math.floor(stats.progressPercentage / 5)) +
130+
'β–‘'.repeat(20 - Math.floor(stats.progressPercentage / 5));
131+
console.log(`πŸ“Š [${progressBar}] ${stats.progressPercentage}%`);
132+
133+
console.log('\nπŸ”₯ Keep up the great work! πŸ”₯\n');
134+
135+
return stats;
136+
}
137+
}
138+
139+
// Main execution
140+
if (require.main === module) {
141+
const tracker = new LeetCodeTracker();
142+
143+
// Check command line arguments
144+
const args = process.argv.slice(2);
145+
146+
if (args.includes('--save') || args.includes('-s')) {
147+
tracker.saveStats();
148+
}
149+
150+
if (args.includes('--quiet') || args.includes('-q')) {
151+
// Just generate stats without display
152+
const stats = tracker.generateStats();
153+
console.log(JSON.stringify(stats, null, 2));
154+
} else {
155+
// Default: display progress
156+
tracker.displayProgress();
157+
}
158+
}
159+
160+
module.exports = LeetCodeTracker;

β€Žstats.jsonβ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"totalProblems": 2,
3+
"foldersCreated": 2,
4+
"currentDay": 3,
5+
"successRate": 67,
6+
"challengeStartDate": "2025-10-01",
7+
"lastUpdated": "2025-10-03T19:31:03.480Z",
8+
"daysRemaining": 87,
9+
"targetProblems": 90,
10+
"averageProblemsPerDay": 0.67,
11+
"progressPercentage": 3,
12+
"completionStatus": "In Progress"
13+
}

0 commit comments

Comments
Β (0)