Show completed parts
This commit is contained in:
parent
dde52bb9db
commit
c604da12c7
50
aocsync.py
50
aocsync.py
@ -1318,6 +1318,19 @@ class HTMLGenerator:
|
||||
for part in day.values():
|
||||
users_with_data.update(part.keys())
|
||||
|
||||
# Calculate stars (completed parts) per user per year
|
||||
stars_by_user_year = defaultdict(lambda: defaultdict(int))
|
||||
for year in data:
|
||||
for day in data[year].values():
|
||||
for part in day.values():
|
||||
for user, time_data in part.items():
|
||||
if isinstance(time_data, dict):
|
||||
total_time = time_data.get('total', 0)
|
||||
else:
|
||||
total_time = time_data if time_data > 0 else 0
|
||||
if total_time > 0:
|
||||
stars_by_user_year[user][year] += 1
|
||||
|
||||
# Check if log file exists
|
||||
log_file_path = Path(config.output_dir) / 'cargo-aoc.log'
|
||||
log_file_exists = log_file_path.exists()
|
||||
@ -1777,6 +1790,43 @@ class HTMLGenerator:
|
||||
<p><strong>Users:</strong> """ + ', '.join(sorted(users)) + """</p>
|
||||
""" + (f'<p><a href="cargo-aoc.log" target="_blank">📋 View Cargo AOC Logs</a></p>' if log_file_exists else '') + """
|
||||
</div>
|
||||
|
||||
<!-- Stars Summary Table -->
|
||||
<div class="summary" style="margin-top: 20px; margin-bottom: 20px;">
|
||||
<h3>⭐ Stars Summary</h3>
|
||||
<p style="font-size: 0.9em; color: #666; margin-bottom: 10px;">Number of completed parts (stars) per user per year</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
"""
|
||||
# Add year columns
|
||||
for year in sorted_years:
|
||||
html += f" <th>{year}</th>\n"
|
||||
html += """ <th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
# Add rows for each user
|
||||
for user in sorted(users):
|
||||
html += f""" <tr>
|
||||
<td><strong>{user}</strong></td>
|
||||
"""
|
||||
total_stars = 0
|
||||
for year in sorted_years:
|
||||
stars = stars_by_user_year[user][year]
|
||||
total_stars += stars
|
||||
if stars > 0:
|
||||
html += f" <td>{stars} ⭐</td>\n"
|
||||
else:
|
||||
html += " <td class=\"no-data\">-</td>\n"
|
||||
html += f" <td><strong>{total_stars} ⭐</strong></td>\n"
|
||||
html += " </tr>\n"
|
||||
|
||||
html += """ </tbody>
|
||||
</table>
|
||||
</div>
|
||||
"""
|
||||
|
||||
# Generate content for each year (sorted descending)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user