Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
0e57dd47
Commit
0e57dd47
authored
3 years ago
by
Jan Prachař
Browse files
Options
Downloads
Patches
Plain Diff
mo/score: Řazení podle roku narození
parent
9fc39f49
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/score.py
+24
-0
24 additions, 0 deletions
mo/score.py
mo/web/templates/org_score.html
+2
-2
2 additions, 2 deletions
mo/web/templates/org_score.html
with
26 additions
and
2 deletions
mo/score.py
+
24
−
0
View file @
0e57dd47
import
decimal
from
flask
import
url_for
from
fractions
import
Fraction
from
sqlalchemy
import
and_
from
sqlalchemy.orm
import
joinedload
...
...
@@ -490,6 +491,7 @@ class Score:
result
.
_order_key
.
append
(
-
modif_points
)
# Na konec třídícího klíče přidáme ročník (menší ročník první)
# a dotřiďovací klíč
for
result
in
self
.
_results
.
values
():
grade
=
normalize_grade
(
result
.
pant
.
grade
)
if
grade
==
-
1
:
...
...
@@ -500,5 +502,27 @@ class Score:
result
.
_order_key
.
append
(
grade
)
result
.
_order_key
.
append
(
result
.
pion
.
score_suborder
or
0
)
# Pokud stále existují sdílená místa, pokusíme se použít rok narození
same_order
=
set
()
last
=
None
for
result
in
sorted
(
self
.
_results
.
values
(),
key
=
lambda
result
:
result
.
_order_key
):
if
last
and
result
.
_order_key
==
last
.
_order_key
:
same_order
.
add
(
last
)
same_order
.
add
(
result
)
last
=
result
if
len
(
same_order
)
>
0
:
if
all
(
result
.
pant
.
birth_year
for
result
in
same_order
):
links
=
[
f
"
{
result
.
user
.
first_name
}
{
result
.
user
.
last_name
}
(
{
result
.
pant
.
birth_year
}
)
"
for
result
in
same_order
]
self
.
_add_message
(
"
info
"
,
f
"
K řazení některých soutěžících byl použit rok narození:
{
'
,
'
.
join
(
links
)
}
.
"
)
for
result
in
self
.
_results
.
values
():
result
.
_order_key
.
append
(
-
result
.
pant
.
birth_year
if
result
.
pant
.
birth_year
else
0
)
else
:
links
=
[
f
"
<a href=
'
{
url_for
(
'
org_user_participant_edit
'
,
user_id
=
result
.
user
.
user_id
,
year
=
result
.
pant
.
year
)
}
'
>
{
result
.
user
.
first_name
}
{
result
.
user
.
last_name
}
</a>
"
for
result
in
same_order
if
not
result
.
pant
.
birth_year
]
self
.
_add_message
(
"
error
"
,
"
Doplňte prosím těmto soutežícím rok narození, aby mohl být použit pro řazení na sdílených místech:
"
+
(
"
,
"
.
join
(
links
))
+
"
.
"
)
if
self
.
_exists_same_order_key
():
self
.
shared_places
=
"
O pořadí na sdílených místech rozhoduje datum narození, případně je třeba ho určit losem.
"
This diff is collapsed.
Click to expand it.
mo/web/templates/org_score.html
+
2
−
2
View file @
0e57dd47
...
...
@@ -66,8 +66,8 @@ Výsledky {{ round.name|round_genitive|lower }}{% if public %} {{ round.year }}.
{% endif %}
</p>
{% for (type, msg) in messages %}
{% if type == "error" %}
<p
class=
"text-danger"
><b>
{{ msg }}
</b></p>
{% elif type == "warning" %}
<p
class=
"text-warning"
>
{{ msg }}
</p>
{% if type == "error" %}
<p
class=
"text-danger"
><b>
{{ msg
| safe
}}
</b></p>
{% elif type == "warning" %}
<p
class=
"text-warning"
>
{{ msg
| safe
}}
</p>
{% else %}
<p>
{{ msg | safe }}{% endif %}
</p>
{% endfor %}
{% endif %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment