コード例 #1
0
ファイル: import_project.py プロジェクト: amcat/amcat
 def import_codingjobs(self):
     old_ids, jobs = [], []
     for job in self._get_dicts("codingjobs.jsonl"):
         j = CodingJob(project_id=self.status.project.id, name=job['name'], archived=job['archived'],
                       insertuser_id=self.status.project.owner.id, coder_id=self.status.users[job['coder']],
                       articleset_id=self.status.setids[job['articleset']])
         if job['articleschema']:
             j.articleschema_id = self.status.codingschemas[job['articleschema']]
         if job['unitschema']:
             j.unitschema_id = self.status.codingschemas[job['unitschema']]
         jobs.append(j)
         old_ids.append(job['pk'])
     jobs = bulk_insert_returning_ids(jobs)
     return {old_id: job.id for (old_id, job) in zip(old_ids, jobs)}