Skip to content
Snippets Groups Projects
Commit 55c6eb5a authored by Jiří Setnička's avatar Jiří Setnička
Browse files

DB: points_history.points může být NULL

Hodí se pro vynulování počtu bodů potom, co byly zadány omylem.
parent 31c7e7cb
Branches
No related tags found
1 merge request!16Zadávání bodů a zobrazení výsledků
......@@ -185,7 +185,7 @@ CREATE TABLE points_history (
points_history_id serial PRIMARY KEY,
task_id int NOT NULL REFERENCES tasks(task_id),
participant_id int NOT NULL REFERENCES users(user_id),
points int NOT NULL,
points int DEFAULT NULL,
points_by int NOT NULL REFERENCES users(user_id), -- kdo přidělil body
points_at timestamp with time zone NOT NULL -- a kdy
);
......
......@@ -806,7 +806,7 @@ def org_contest_task_points(contest_id: int, task_id: int):
count = 0
for sol in solutions:
points = request.form.get(f"points_{sol.user_id}", type=int)
if points is not None and points != sol.points:
if points != sol.points:
# Save points
sol.points = points
sess.add(db.PointsHistory(
......
......@@ -97,7 +97,7 @@
{% for p in points_history %}
<tr {% if loop.index == 1 %} class='sol-active'{% endif %}>
<td>{{ p.points_at|timeformat }}
<td>{{ p.points }}
<td>{{ p.points or '–' }}
<td>{{ p.user|user_link }}
</tr>
{% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment