Skip to content

Commit

Permalink
Merge pull request #569 from robertatakenaka/evita_excecao_por_ausenc…
Browse files Browse the repository at this point in the history
…ia_de_journal_proc

Evita exceção por IssueProc.journal_proc=None
  • Loading branch information
robertatakenaka authored Nov 12, 2024
2 parents c945247 + 0a3951b commit 06bf160
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions proc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,14 @@ class IssueProc(BaseProc, ClusterableModel):
)

def __unicode__(self):
return f"{self.journal_proc.acron} {self.issue_folder} ({self.collection})"
if self.journal_proc:
return f"{self.journal_proc.acron} {self.issue_folder} ({self.collection})"
return f"{self.collection} {self.pid}"

def __str__(self):
return f"{self.journal_proc.acron} {self.issue_folder} ({self.collection})"
if self.journal_proc:
return f"{self.journal_proc.acron} {self.issue_folder} ({self.collection})"
return f"{self.collection} {self.pid}"

journal_proc = models.ForeignKey(
JournalProc, on_delete=models.SET_NULL, null=True, blank=True
Expand Down Expand Up @@ -1162,7 +1166,17 @@ def migrate_document_records(self, user, force_update=None):
# logging.info(f"Skip migrate_document_records {self.pid}")
return

self.docs_status = tracker_choices.PROGRESS_STATUS_DOING
self.save()

operation = self.start(user, "migrate_document_records")

if not self.journal_proc:
self.docs_status = tracker_choices.PROGRESS_STATUS_BLOCKED
self.save()
operation.finish(user, completed=False, detail={"journal_proc": None})
return

done = 0
journal_data = self.journal_proc.migrated_data.data

Expand Down

0 comments on commit 06bf160

Please sign in to comment.