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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
cf9dbac3
Commit
cf9dbac3
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Rozdělena práva k výsledkovce na view_contestants a view_submits
parent
2b4c8634
No related branches found
No related tags found
1 merge request
!95
Reforma orgovského rozhraní ke kolům a soutěžím
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/org_score.py
+10
-5
10 additions, 5 deletions
mo/web/org_score.py
with
10 additions
and
5 deletions
mo/web/org_score.py
+
10
−
5
View file @
cf9dbac3
...
...
@@ -43,11 +43,13 @@ class SolPointsCell(Cell):
contest_id
:
int
user
:
db
.
User
sol
:
Optional
[
db
.
Solution
]
link_to_paper
:
bool
def
__init__
(
self
,
contest_id
:
int
,
user
:
db
.
User
,
sol
:
Optional
[
db
.
Solution
]):
def
__init__
(
self
,
contest_id
:
int
,
user
:
db
.
User
,
sol
:
Optional
[
db
.
Solution
]
,
link_to_paper
:
bool
):
self
.
contest_id
=
contest_id
self
.
user
=
user
self
.
sol
=
sol
self
.
link_to_paper
=
link_to_paper
def
__str__
(
self
)
->
str
:
if
not
self
.
sol
:
...
...
@@ -64,7 +66,9 @@ class SolPointsCell(Cell):
else
:
points
=
format_decimal
(
self
.
sol
.
points
)
if
self
.
sol
.
final_feedback_obj
:
if
not
self
.
link_to_paper
:
return
f
'
<td>
{
points
}
'
elif
self
.
sol
.
final_feedback_obj
:
url
=
mo
.
web
.
util
.
org_paper_link
(
self
.
contest_id
,
None
,
self
.
user
,
self
.
sol
.
final_feedback_obj
)
return
f
'
<td><a href=
"
{
url
}
"
title=
"
Zobrazit finální opravu
"
>
{
points
}
</a>
'
elif
self
.
sol
.
final_submit_obj
:
...
...
@@ -84,9 +88,9 @@ def org_score(round_id: Optional[int] = None, ct_id: Optional[int] = None):
sess
=
db
.
get_session
()
# FIXME
if
not
ctx
.
rights
.
have_right
(
Right
.
view_submits
):
if
not
ctx
.
rights
.
have_right
(
Right
.
view_contestants
):
raise
werkzeug
.
exceptions
.
Forbidden
()
can_view_submits
=
ctx
.
rights
.
have_right
(
Right
.
view_submits
)
score
=
Score
(
round
.
master
,
contest
)
tasks
=
score
.
get_tasks
()
...
...
@@ -175,7 +179,8 @@ def org_score(round_id: Optional[int] = None, ct_id: Optional[int] = None):
for
task
in
tasks
:
local_sol_ct_id
=
subcontest_id_map
[(
task
.
round_id
,
pion
.
contest_id
)]
row
.
keys
[
f
'
task_
{
task
.
task_id
}
'
]
=
SolPointsCell
(
contest_id
=
local_sol_ct_id
,
user
=
user
,
sol
=
sols
.
get
(
task
.
task_id
)
contest_id
=
local_sol_ct_id
,
user
=
user
,
sol
=
sols
.
get
(
task
.
task_id
),
link_to_paper
=
can_view_submits
)
if
result
.
winner
:
row
.
html_attr
=
{
"
class
"
:
"
winner
"
,
"
title
"
:
"
Vítěz
"
}
...
...
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