-
Notifications
You must be signed in to change notification settings - Fork 7
Corrige questões do fluxo de journal: coleta de dados do core e publicação no site qa ou público #1047
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
Corrige questões do fluxo de journal: coleta de dados do core e publicação no site qa ou público #1047
Changes from 8 commits
564ebc4
650b1e4
1d293b4
8241297
a40a1d2
552a13e
83a4210
5f0a3c3
470c2e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated by Django 5.2.3 on 2026-06-17 13:14 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("journal", "0014_alter_journal_title_alter_officialjournal_title"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="officialjournal", | ||
| name="next_journal_title", | ||
| field=models.CharField(blank=True, max_length=500, null=True), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,9 +364,11 @@ def process_journal_result( | |
| foundation_year=official.get("foundation_year"), | ||
| user=user, | ||
| ) | ||
| next_jt = result.get("next_journal_title") | ||
| prev_jt = result.get("previous_journal_title") | ||
| official_journal.add_related_journal( | ||
| result.get("previous_journal_title"), | ||
| result.get("next_journal_title"), | ||
| prev_jt.get("previous_journal_title") if isinstance(prev_jt, dict) else prev_jt, | ||
| next_jt.get("next_journal_title") if isinstance(next_jt, dict) else next_jt, | ||
| ) | ||
|
|
||
| # Cria/atualiza o journal | ||
|
|
@@ -396,42 +398,47 @@ def process_journal_result( | |
| for item in result.get("subject") or []: | ||
| journal.subject.add(Subject.create_or_update(user, item["value"])) | ||
|
|
||
| # Processa publishers | ||
| institution_names = set() | ||
| for item in result.get("publisher") or []: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. é garantido que |
||
| institution = Institution.get_or_create( | ||
| inst_name=item["name"], | ||
| institution_names.add(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
|
|
||
| # Processa owners | ||
| for item in result.get("owner") or []: | ||
| institution_names.add(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
|
|
||
| for item in result.get("sponsor") or []: | ||
| institution_names.add(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
|
|
||
| institutions = {} | ||
| for name in institution_names: | ||
| institutions[name] = Institution.get_or_create( | ||
| inst_name=name, | ||
| inst_acronym=None, | ||
| level_1=None, | ||
| level_2=None, | ||
| level_3=None, | ||
| location=None, | ||
| user=user, | ||
| ) | ||
|
|
||
| # Processa publishers | ||
| for item in result.get("publisher") or []: | ||
| institution = institutions.get(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
| if not institution: | ||
| continue | ||
| journal.publisher.add(Publisher.create_or_update(user, journal, institution)) | ||
|
|
||
| # Processa owners | ||
| for item in result.get("owner") or []: | ||
| institution = Institution.get_or_create( | ||
| inst_name=item["name"], | ||
| inst_acronym=None, | ||
| level_1=None, | ||
| level_2=None, | ||
| level_3=None, | ||
| location=None, | ||
| user=user, | ||
| ) | ||
| institution = institutions.get(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
| if not institution: | ||
| continue | ||
| journal.owner.add(Owner.create_or_update(user, journal, institution)) | ||
|
|
||
| for item in result.get("sponsor") or []: | ||
| institution = Institution.get_or_create( | ||
| inst_name=item["name"], | ||
| inst_acronym=None, | ||
| level_1=None, | ||
| level_2=None, | ||
| level_3=None, | ||
| location=None, | ||
| user=user, | ||
| ) | ||
| institution = institutions.get(item["name"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não seria mais seguro usar |
||
| if not institution: | ||
| continue | ||
| journal.sponsor.add(Sponsor.create_or_update(user, journal, institution)) | ||
|
|
||
| no_lang = [] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,8 @@ def publish_journal(journal_proc, api_data): | |
| fetch_and_create_journal( | ||
| user=journal_proc.updated_by or journal_proc.creator, | ||
| collection_acron=journal_proc.collection.acron, | ||
| issn_electronic=journal.issn_print, | ||
| issn_print=journal.issn_electronic, | ||
| issn_electronic=journal.issn_electronic, | ||
| issn_print=journal.issn_print, | ||
|
Comment on lines
-23
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) |
||
| force_update=True, | ||
| ) | ||
| except: | ||
|
|
@@ -199,6 +199,8 @@ def add_issue_count(self, issue_count): | |
|
|
||
| def add_sponsor(self, sponsor): | ||
| # Sponsors | ||
| if not sponsor: | ||
| return | ||
| self.data["sponsors"].append({"name": sponsor}) | ||
|
|
||
| @staticmethod | ||
|
|
@@ -299,5 +301,7 @@ def add_is_public(self, availability_status): | |
| self.data["is_public"] = availability_status == "C" | ||
|
|
||
| def add_publisher(self, name): | ||
| if not name: | ||
| return | ||
| self.data.setdefault("institution_responsible_for", []) | ||
| self.data["institution_responsible_for"].append({"name": name}) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poderia usar um helper como: