Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evita exceção por IssueProc.journal_proc=None #569

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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