diff --git a/src/sinol_make/contest_types/__init__.py b/src/sinol_make/contest_types/__init__.py index 98887606..d1815492 100644 --- a/src/sinol_make/contest_types/__init__.py +++ b/src/sinol_make/contest_types/__init__.py @@ -1,6 +1,7 @@ from sinol_make.contest_types.default import DefaultContest from sinol_make.contest_types.icpc import ICPCContest from sinol_make.contest_types.oi import OIContest +from sinol_make.contest_types.oij import OIJContest from sinol_make.helpers.package_util import get_config from sinol_make.interfaces.Errors import UnknownContestType @@ -15,5 +16,7 @@ def get_contest_type(): return OIContest() elif contest_type == "icpc": return ICPCContest() + elif contest_type == "oij": + return OIJContest() else: raise UnknownContestType(f'Unknown contest type "{contest_type}"') diff --git a/src/sinol_make/contest_types/oij.py b/src/sinol_make/contest_types/oij.py new file mode 100644 index 00000000..3536b93b --- /dev/null +++ b/src/sinol_make/contest_types/oij.py @@ -0,0 +1,32 @@ +import argparse + +from sinol_make import util +from sinol_make.helpers import package_util +from sinol_make.contest_types.default import DefaultContest + + +class OIJContest(DefaultContest): + """ + Contest type for Polish Junior Olympiad in Informatics. + """ + + def get_type(self) -> str: + return "oij" + + def argument_overrides(self, args: argparse.Namespace) -> argparse.Namespace: + """ + Add arguments for features required by OIJ contest + """ + args.export_ocen = True + return args + + def verify_pre_gen(self): + """ + Verify if scores sum up to 100. + """ + config = package_util.get_config() + if 'scores' not in config: + util.exit_with_error("Scores are not defined in config.yml.") + total_score = sum(config['scores'].values()) + if total_score != 100: + util.exit_with_error(f"Total score in config is {total_score}, but should be 100.")