Skip to content
Snippets Groups Projects

Import orgů

Merged Jiří Kalvoda requested to merge jk/import-orgu into devel
Compare and Show latest version
1 file
+ 3
7
Compare changes
  • Side-by-side
  • Inline
+ 3
7
@@ -74,10 +74,9 @@ class Import:
line_number: int = 0
row_name: Optional[str] = None
def __init__(self, user):
def __init__(self, user: db.User):
self.errors = []
self.warnings = []
self.rr = None
self.place_cache = {}
self.school_place_cache = {}
self.new_user_ids = []
@@ -205,7 +204,6 @@ class Import:
r = (
db.get_session().query(db.Round)
.filter_by(year=year, category=category, seq=seq)
.with_for_update()
.one_or_none()
)
if r is None:
@@ -266,10 +264,8 @@ class Import:
return False
return True
def obtain_contest(self, round: Optional[db.Round], oblast: Optional[db.Place], allow_none: bool = False) -> Optional[db.Contest]:
def obtain_contest(self, round: db.Round, oblast: Optional[db.Place], allow_none: bool = False) -> Optional[db.Contest]:
contest: Optional[db.Contest]
if not round:
return None
if oblast is not None and not self.place_is_allowed(oblast):
return self.error('Oblast neodpovídá té, do které se importuje')
if self.contest:
@@ -596,7 +592,7 @@ class OrgsImport(Import):
self.setup()
self.allow_change_user_to_org = allow_change_user_to_org
self.root_place = db.get_root_place()
self.year = self.year if round else year
self.year = round.year if round else year
assert hasattr(self.row_class, "kolo") or self.round
def import_row(self, r: mo.csv.Row):
Loading