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

Webový export výsledkovky obsahuje název oblasti

Web MO to nepoužívá, ale využijeme to pro MO-P.
parent 374a889a
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,9 @@ Strojově čitelná podoba v JSON ...@@ -49,6 +49,9 @@ Strojově čitelná podoba v JSON
// Čas poslední aktualizace listiny (formát dle RFC 3339) // Čas poslední aktualizace listiny (formát dle RFC 3339)
"generated_at": "YYYY-MM-DD HH:MM:SS", "generated_at": "YYYY-MM-DD HH:MM:SS",
// Soutěžňí oblast
"region": "Královéhradecký kraj",
// Seznam úloh // Seznam úloh
"tasks": [ "tasks": [
{ {
......
...@@ -309,7 +309,7 @@ class ExportScoreToMOWebError(SoftJobError): ...@@ -309,7 +309,7 @@ class ExportScoreToMOWebError(SoftJobError):
# Také voláme z bin/freeze-score # Také voláme z bin/freeze-score
def get_web_json(score_table: mo.db.ScoreTable): def get_web_json(score_table: mo.db.ScoreTable, contest: db.Contest):
json_tasks = [{ json_tasks = [{
"code": t['code'], "code": t['code'],
"name": t.get("name", None) or None, "name": t.get("name", None) or None,
...@@ -339,6 +339,7 @@ def get_web_json(score_table: mo.db.ScoreTable): ...@@ -339,6 +339,7 @@ def get_web_json(score_table: mo.db.ScoreTable):
return { return {
'osmo_id': score_table.scoretable_id, 'osmo_id': score_table.scoretable_id,
'generated_at': score_table.created_at.strftime("%Y-%m-%d %H:%M:%S"), 'generated_at': score_table.created_at.strftime("%Y-%m-%d %H:%M:%S"),
'region': contest.place.name,
'tasks': json_tasks, 'tasks': json_tasks,
'boundary': { 'boundary': {
'winner': score_table.score_metadata.get('boundary', {}).get('winner', None), 'winner': score_table.score_metadata.get('boundary', {}).get('winner', None),
...@@ -379,7 +380,7 @@ def handle_export_score_to_mo_web(the_job: TheJob): ...@@ -379,7 +380,7 @@ def handle_export_score_to_mo_web(the_job: TheJob):
sess.commit() sess.commit()
raise ExportScoreToMOWebError(f"Publikování výsledkové listiny ({data_format}) na webu MO: {err_text}") raise ExportScoreToMOWebError(f"Publikování výsledkové listiny ({data_format}) na webu MO: {err_text}")
json = get_web_json(score_table) json = get_web_json(score_table, contest)
auth = requests.auth.HTTPBasicAuth(config.MO_WEB_LOGIN, config.MO_WEB_PASSWD) auth = requests.auth.HTTPBasicAuth(config.MO_WEB_LOGIN, config.MO_WEB_PASSWD)
params = api_params(contest) params = api_params(contest)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment