Skip to content
Snippets Groups Projects
Commit 7614a61e authored by Martin Mareš's avatar Martin Mareš
Browse files

Zvýrazňování řešení odevzdaných po deadline

parent 7ac9bfea
No related branches found
No related tags found
1 merge request!9WIP: Zárodek uživatelské části webu a submitování
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import datetime import datetime
from enum import Enum as PythonEnum, auto from enum import Enum as PythonEnum, auto
from mo.util_format import time_and_timedelta from mo.util_format import timedelta, time_and_timedelta
import re import re
from sqlalchemy import \ from sqlalchemy import \
Boolean, Column, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint, \ Boolean, Column, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint, \
...@@ -415,6 +415,19 @@ class Paper(Base): ...@@ -415,6 +415,19 @@ class Paper(Base):
for_user_obj = relationship('User', primaryjoin='Paper.for_user == User.user_id') for_user_obj = relationship('User', primaryjoin='Paper.for_user == User.user_id')
uploaded_by_obj = relationship('User', primaryjoin='Paper.uploaded_by == User.user_id') uploaded_by_obj = relationship('User', primaryjoin='Paper.uploaded_by == User.user_id')
def check_deadline(self, round: Round) -> Optional[str]:
# K round se dá dostat přes self.task.round, ale nejspíš to není nakešované.
if self.uploaded_by == self.for_user:
deadline = round.ct_submit_end
suffix = ' účastnickém termínu'
else:
deadline = round.pr_submit_end
suffix = ' dozorovém termínu'
if deadline is not None and self.uploaded_at > deadline:
return timedelta(self.uploaded_at, deadline, descriptive=True) + suffix
else:
return None
class PointsHistory(Base): class PointsHistory(Base):
__tablename__ = 'points_history' __tablename__ = 'points_history'
... ...
......
...@@ -544,7 +544,7 @@ def org_submit_list(contest_id: int, user_id: int, task_id: int, site_id: Option ...@@ -544,7 +544,7 @@ def org_submit_list(contest_id: int, user_id: int, task_id: int, site_id: Option
return render_template( return render_template(
'org_submit_list.html', 'org_submit_list.html',
sc=sc, sc=sc,
sol=sol, solution=sol,
sol_papers=sol_papers, sol_papers=sol_papers,
fb_papers=fb_papers, fb_papers=fb_papers,
for_site=(site_id is not None), for_site=(site_id is not None),
... ...
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
{% set active_sol_id = None %} {% set active_sol_id = None %}
{% endif %} {% endif %}
{% for p in sol_papers %} {% for p in sol_papers %}
{% set late = p.check_deadline(sc.round) %}
<tr{% if p.paper_id == active_sol_id %} class='sol-active'{% endif %}> <tr{% if p.paper_id == active_sol_id %} class='sol-active'{% endif %}>
{# FIXME: Zvýrazňovat pozdní #} <td{% if late %} class='sol-late'{% endif %}>{{ p.uploaded_at|timeformat }}
<td>{{ p.uploaded_at|timeformat }}
<td>{{ p.pages }} <td>{{ p.pages }}
<td>{{ p.bytes }} <td>{{ p.bytes }}
<td>{{ p.uploaded_by_obj.full_name() }} <td>{{ p.uploaded_by_obj.full_name() }}
<td>{{ p.note }} <td>{% if late %}<span class='sol-late'>({{ late }})</span> {% endif %}{{ p.note }}
<td><a class='btn btn-xs btn-primary' href='{{ paper_link(p) }}'>Stáhnout</a> <td><a class='btn btn-xs btn-primary' href='{{ paper_link(p) }}'>Stáhnout</a>
{% endfor %} {% endfor %}
</table> </table>
... ...
......
...@@ -127,3 +127,7 @@ nav#main-menu a.active { ...@@ -127,3 +127,7 @@ nav#main-menu a.active {
.sol-active { .sol-active {
background-color: yellow; background-color: yellow;
} }
.sol-late {
color: red;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment