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
d0dadef2
Commit
d0dadef2
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
test-pdf-score: testování sazby výsledkovek
parent
0637f55b
No related branches found
No related tags found
1 merge request
!118
Sazba výsledkovek TeXem
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/test-pdf-score
+56
-0
56 additions, 0 deletions
bin/test-pdf-score
with
56 additions
and
0 deletions
bin/test-pdf-score
0 → 100755
+
56
−
0
View file @
d0dadef2
#!/usr/bin/env python3
import
argparse
import
mo.db
as
db
import
mo.jobs.score
from
mo.score
import
Score
from
mo.util
import
init_standalone
import
os
import
shutil
from
sqlalchemy.orm
import
joinedload
parser
=
argparse
.
ArgumentParser
(
description
=
'
Testuje generování výsledkových listin v PDF
'
)
parser
.
add_argument
(
'
--contest
'
,
type
=
int
,
metavar
=
'
ID
'
,
help
=
'
soutěž
'
)
parser
.
add_argument
(
'
--year
'
,
type
=
int
,
metavar
=
'
ID
'
,
help
=
'
ročník
'
)
args
=
parser
.
parse_args
()
init_standalone
()
sess
=
db
.
get_session
()
ctq
=
sess
.
query
(
db
.
Contest
).
join
(
db
.
Contest
.
round
)
if
args
.
contest
is
not
None
:
ctq
=
ctq
.
filter
(
db
.
Contest
.
contest_id
==
args
.
contest
)
else
:
ctq
=
ctq
.
filter
(
db
.
Round
.
round_type
!=
db
.
RoundType
.
other
)
if
args
.
year
is
not
None
:
ctq
=
ctq
.
filter
(
db
.
Round
.
year
==
args
.
year
)
contests
=
ctq
.
options
(
joinedload
(
db
.
Contest
.
round
)).
all
()
for
ct
in
contests
:
r
=
ct
.
round
print
(
f
'
#
{
ct
.
contest_id
}
:
{
r
.
round_code_short
()
}
(
{
ct
.
place
.
get_code
()
}
)
'
)
score
=
Score
(
r
.
master
,
ct
)
results
=
score
.
get_sorted_results
()
for
severity
,
msg
in
score
.
get_messages
():
if
severity
!=
'
info
'
:
print
(
f
'
\t
{
severity
}
:
{
msg
}
'
)
temp_dir
=
f
'
tmp/score/
{
r
.
round_code_short
()
}
/
{
ct
.
place
.
get_code
()
}
'
shutil
.
rmtree
(
temp_dir
,
ignore_errors
=
True
)
os
.
makedirs
(
temp_dir
,
exist_ok
=
True
)
pdf
=
mo
.
jobs
.
score
.
make_score_pdf
(
temp_dir
,
score
,
results
)
final
=
f
'
{
temp_dir
}
.pdf
'
try
:
os
.
unlink
(
final
)
except
FileNotFoundError
:
pass
os
.
link
(
pdf
,
final
)
print
(
f
'
\t
=>
{
final
}
'
)
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