def _remove_abstract(self, legacy_abstract): abstract = legacy_abstract.as_new # do not use relationshio or with_parent since the contribution # might have been soft-deleted and this does not show up in the # relationship anymore for contrib in Contribution.find(abstract=abstract): contrib.abstract = None for judgment in abstract.judgments: db.session.delete(judgment) db.session.delete(abstract) db.session.flush()
def _migrate_contribution_tracks(self): for contrib in Contribution.find(Contribution.event_new == self.event, ~Contribution.legacy_track_id.is_(None)): if contrib.legacy_track_id not in self.track_map_by_id: self.importer.print_warning(cformat( "%{yellow!}{} %{reset}assigned to track %{yellow!}{}%{reset} which doesn't exist. Unassigning it.") .format(contrib, contrib.track_id), event_id=self.event.id) contrib.track = None continue track = self.track_map_by_id[contrib.legacy_track_id] contrib.track = track self.importer.print_success(cformat('%{blue!}{} %{reset}-> %{yellow!}{}').format(contrib, track), event_id=self.event.id)
def _migrate_contribution_tracks(self): for contrib in Contribution.find( Contribution.event_new == self.event, ~Contribution.legacy_track_id.is_(None)): if contrib.legacy_track_id not in self.track_map_by_id: self.importer.print_warning(cformat( "%{yellow!}{} %{reset}assigned to track %{yellow!}{}%{reset} which doesn't exist. Unassigning it." ).format(contrib, contrib.track_id), event_id=self.event.id) contrib.track = None continue track = self.track_map_by_id[contrib.legacy_track_id] contrib.track = track self.importer.print_success( cformat('%{blue!}{} %{reset}-> %{yellow!}{}').format( contrib, track), event_id=self.event.id)