Skip to content
Snippets Groups Projects

Publikace výsledkovky na web MO

Merged Jiří Kalvoda requested to merge jk/vysledkovka into devel
1 file
+ 11
7
Compare changes
  • Side-by-side
  • Inline
+ 11
7
@@ -5,7 +5,7 @@ import json
@@ -5,7 +5,7 @@ import json
import os
import os
import subprocess
import subprocess
import requests
import requests
from typing import Iterable, Optional
from typing import Any, Dict, Iterable, Optional
import mo
import mo
import mo.config as config
import mo.config as config
@@ -166,6 +166,15 @@ def handle_snapshot_score(the_job: TheJob):
@@ -166,6 +166,15 @@ def handle_snapshot_score(the_job: TheJob):
#
#
 
def api_params(contest: db.Contest) -> Dict[str, Any]:
 
round = contest.round
 
return {
 
'season': round.year,
 
'category': round.category,
 
'round': mo.util.assert_not_none(round.round_type.letter()),
 
'region': contest.place.nuts,
 
}
 
def schedule_export_score_to_mo_web(score_table: db.ScoreTable) -> None:
def schedule_export_score_to_mo_web(score_table: db.ScoreTable) -> None:
the_job = TheJob()
the_job = TheJob()
job = the_job.create(db.JobType.export_score_to_mo_web, db.get_system_user())
job = the_job.create(db.JobType.export_score_to_mo_web, db.get_system_user())
@@ -248,12 +257,7 @@ def handle_export_score_to_mo_web(the_job: TheJob):
@@ -248,12 +257,7 @@ def handle_export_score_to_mo_web(the_job: TheJob):
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 = {
params = api_params(contest)
'season': round.year,
'category': round.category,
'round': mo.util.assert_not_none(round.round_type.letter()),
'region': contest.place.nuts,
}
try:
try:
reply = requests.post(
reply = requests.post(
Loading