From 99770c2bd59f5f72ea208a896c20b3780d6cf71e Mon Sep 17 00:00:00 2001 From: Rafael JPD Date: Sun, 25 May 2025 11:53:37 -0300 Subject: [PATCH 1/3] =?UTF-8?q?Otimiza=20obten=C3=A7=C3=A3o=20de=20metadad?= =?UTF-8?q?os=20de=20artigo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- article/models.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/article/models.py b/article/models.py index 90402ca..67fc565 100644 --- a/article/models.py +++ b/article/models.py @@ -95,8 +95,24 @@ def __str__(self): @classmethod def metadata(cls, collection=None): - objs = cls.objects.all() if not collection else cls.objects.filter(collection=collection) - for a in objs: + qs = cls.objects.select_related('collection').only( + 'collection__acron3', + 'default_lang', + 'files', + 'pid_v2', + 'pid_v3', + 'pid_generic', + 'processing_date', + 'publication_date', + 'publication_year', + 'scielo_issn', + 'text_langs', + ) + + if collection: + qs = qs.filter(collection=collection) + + for a in qs.iterator(): yield { 'collection': a.collection.acron3, 'default_lang': a.default_lang, From 0bd912c25e0a7ce4c80f1ce5d5f1dad61ab7e185 Mon Sep 17 00:00:00 2001 From: Rafael JPD Date: Sun, 25 May 2025 11:54:47 -0300 Subject: [PATCH 2/3] =?UTF-8?q?Otimiza=20obten=C3=A7=C3=A3o=20de=20metadad?= =?UTF-8?q?os=20de=20peri=C3=B3dico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journal/models.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/journal/models.py b/journal/models.py index 948585a..f9725b5 100644 --- a/journal/models.py +++ b/journal/models.py @@ -69,17 +69,23 @@ def __str__(self): @classmethod def metadata(cls, collection=None): - objs = cls.objects.all() if not collection else cls.objects.filter(collection=collection) - for j in objs: + queryset = cls.objects.all() + if collection: + queryset = queryset.filter(collection=collection) + + for journal in queryset.only( + 'acronym', 'collection__acron3', 'issns', 'publisher_name', + 'scielo_issn', 'subject_areas', 'title', 'wos_subject_areas' + ): yield { - 'acronym': j.acronym, - 'collection': j.collection.acron3, - 'issns': j.issns, - 'publisher_name': j.publisher_name, - 'scielo_issn': j.scielo_issn, - 'subject_areas': j.subject_areas, - 'title': j.title, - 'wos_subject_areas': j.wos_subject_areas, + 'acronym': journal.acronym, + 'collection': journal.collection.acron3, + 'issns': set([v for v in journal.issns.values() if v]), + 'publisher_name': journal.publisher_name, + 'scielo_issn': journal.scielo_issn, + 'subject_areas': journal.subject_areas, + 'title': journal.title, + 'wos_subject_areas': journal.wos_subject_areas, } class Meta: From 48784561b7774913f739759517eb5080996ccc5c Mon Sep 17 00:00:00 2001 From: Rafael JPD Date: Sun, 25 May 2025 11:55:38 -0300 Subject: [PATCH 3/3] =?UTF-8?q?Sobe=20vers=C3=A3o=20para=201.9.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index abb1658..ee672d8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.0 \ No newline at end of file +1.9.1 \ No newline at end of file