Skip to content

Commit

Permalink
Adiciona o campo wos_area e o método get_wos_area no JournalSerializer (
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelveigarangel authored Jan 16, 2025
1 parent c830ec5 commit 69673be
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions journal/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class JournalSerializer(serializers.ModelSerializer):
next_journal_title = serializers.SerializerMethodField()
previous_journal_title = serializers.SerializerMethodField()
toc_items = serializers.SerializerMethodField()
wos_areas = serializers.SerializerMethodField()

def get_institution_history(self, institution_history):
if queryset := institution_history.all():
Expand Down Expand Up @@ -179,7 +180,7 @@ def get_other_titles(self, obj):
return None

def get_next_journal_title(self, obj):
if obj.official.next_journal_title:
if obj.official and obj.official.next_journal_title:
try:
journal_new_title = models.Journal.objects.get(title__icontains=obj.official.next_journal_title)
issn_print = journal_new_title.official.issn_print
Expand All @@ -194,7 +195,7 @@ def get_next_journal_title(self, obj):
}

def get_previous_journal_title(self, obj):
if obj.official.previous_journal_titles:
if obj.official and obj.official.previous_journal_titles:
try:
old_journal = obj.official.old_title.get(
title__icontains=obj.official.previous_journal_titles
Expand Down Expand Up @@ -222,6 +223,11 @@ def get_toc_items(self, obj):
})
return data

def get_wos_areas(self, obj):
if obj.wos_area.all():
return [wos_area.value for wos_area in obj.wos_area.all()]
return None


class Meta:
model = models.Journal
Expand Down Expand Up @@ -254,5 +260,5 @@ class Meta:
"title_in_database",
"url_logo",
"mission",

"wos_areas",
]

0 comments on commit 69673be

Please sign in to comment.