Skip to content

Commit 5bb567a

Browse files
committed
Extend columns in the scoreboard
1 parent 3f2f07e commit 5bb567a

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

scoreboard/main.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
task_type_dir = tasks_dir / task_type
1212
if task_type_dir.exists() and task_type_dir.is_dir():
1313
for task_name in (d.name for d in task_type_dir.iterdir() if d.is_dir()):
14-
directories[task_name][task_type] = True
14+
if task_name.endswith("_disabled"):
15+
task_name = task_name[:-len("_disabled")]
16+
directories[task_name][task_type] = "disabled"
17+
else:
18+
directories[task_name][task_type] = "done"
1519

1620
print(directories)
1721

18-
columns = ''.join(['<th>' + task_type + '</th>' for task_type in task_types])
22+
columns = ''.join(['<th colspan=4 style="text-align: center;">' + task_type + '</th>' for task_type in task_types])
1923
html_content = f"""
2024
<!DOCTYPE html>
2125
<html>
@@ -25,20 +29,36 @@
2529
</head>
2630
<body>
2731
<h1>Scoreboard</h1>
32+
<p>S - Solution, P - Performance, O - Overdue, C - Cheating</p>
2833
<table>
2934
<tr>
30-
<th>Tasks</th>
35+
<th colspan=4>Tasks</th>
3136
{columns}
37+
<th>Total</th>
38+
</tr>
39+
<tr>
40+
<th colspan=4></th>
41+
{''.join(['<th>S</th><th>P</th><th>O</th><th>C</th>' for _ in range(len(task_types))])}
42+
<th></th>
3243
</tr>
3344
"""
3445

3546
for dir in directories:
36-
html_content += f"<tr><td>{dir}</td>"
47+
html_content += f"<tr><td colspan=4>{dir}</td>"
48+
total_count = 0
3749
for task_type in task_types:
38-
if directories[dir].get(task_type):
39-
html_content += "<td>✔</td>"
50+
if directories[dir].get(task_type) == "done":
51+
html_content += '<td style="text-align: center;">1</td>'
52+
total_count += 1
53+
elif directories[dir].get(task_type) == "disabled":
54+
html_content += '<td style="text-align: center;background-color: lightblue;">1</td>'
55+
total_count += 1
4056
else:
41-
html_content += "<td>✘</td>"
57+
html_content += "<td>0</td>"
58+
html_content += '<td style="text-align: center;">0</td>'
59+
html_content += '<td style="text-align: center;">0</td>'
60+
html_content += '<td style="text-align: center;">0</td>'
61+
html_content += f'<td style="text-align: center;">{total_count}</td>'
4262
html_content += "</tr>"
4363

4464
html_content += """

0 commit comments

Comments
 (0)