Skip to content

Commit

Permalink
Merge pull request #463 from patymori/tk-opac-1272
Browse files Browse the repository at this point in the history
Corrige a carga de periódicos sem fascículos para o site
  • Loading branch information
patymori authored May 14, 2019
2 parents 8c8f04c + d165e38 commit 407d32c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
25 changes: 23 additions & 2 deletions opac_proc/loaders/lo_journals.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class JournalLoader(BaseLoader):
'last_issue',
'metrics',
'editor_email',
'is_public',
]

def prepare_collection(self):
Expand Down Expand Up @@ -168,9 +169,14 @@ def prepare_last_issue(self):
"""
logger.debug(u"iniciando: prepare_last_issue")
t_journal_uuid = self.transform_model_instance.uuid
t_issue = TransformIssue.objects.filter(
journal=t_journal_uuid).order_by('-year', '-order').first().select_related()
t_issues = TransformIssue.objects.filter(
journal=t_journal_uuid).order_by('-year', '-order')

if not t_issues:
logger.info(u"Não existem issues para journal uuid: %s" % t_journal_uuid)
return None

t_issue = t_issues.first().select_related()
logger.debug(u"last issue: t_issue encontrado (iid: %s)" % t_issue.iid)
last_issue_sections = []
if hasattr(t_issue, 'sections'):
Expand Down Expand Up @@ -231,3 +237,18 @@ def prepare_metrics(self):

logger.debug(u"metrics criadas: %s", metrics_dict)
return metrics_doc

def prepare_is_public(self):
"""
metodo chamado na preparação dos dados a carregar no opac_schema
deve retornar um valor válido para Journal.is_public
"""
logger.debug(u"iniciando: prepare_is_public")
if self.opac_model_instance and hasattr(self.opac_model_instance, 'is_public'):
logger.debug(u"is_public configurado: %s" % getattr(self.opac_model_instance, 'is_public'))
return self.opac_model_instance.is_public
issue_count = TransformIssue.objects.filter(
journal=self.transform_model_instance.uuid).count()
is_public = True if issue_count > 0 else False
logger.info(u"Periódico público: %s" % is_public)
return is_public
27 changes: 16 additions & 11 deletions opac_proc/web/views/load/list_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class LoadJournalListView(LoadBaseListView):
'field_type': 'string'
},
{
'field_label': u'Aconym',
'field_label': u'Acronym',
'field_name': 'loaded_data.acronym',
'field_type': 'string'
},
Expand Down Expand Up @@ -146,18 +146,18 @@ class LoadJournalListView(LoadBaseListView):
'field_type': 'uuid'
},
{
'field_label': u'Aconym',
'field_name': 'loaded_data.acronym',
'field_label': u'Acronym',
'field_name': 'loaded_data__acronym',
'field_type': 'string'
},
{
'field_label': u'Print ISSN',
'field_name': 'loaded_data.print_issn',
'field_name': 'loaded_data__print_issn',
'field_type': 'string'
},
{
'field_label': u'SciELO ISSN',
'field_name': 'loaded_data.scielo_issn',
'field_name': 'loaded_data__scielo_issn',
'field_type': 'string'
},
{
Expand Down Expand Up @@ -238,18 +238,23 @@ class LoadIssueListView(LoadBaseListView):
'field_type': 'uuid'
},
{
'field_label': u'Aconym',
'field_name': 'loaded_data.acronym',
'field_label': u'PID',
'field_name': 'loaded_data__pid',
'field_type': 'string'
},
{
'field_label': u'Print ISSN',
'field_name': 'loaded_data.print_issn',
'field_label': u'Volume',
'field_name': 'loaded_data__volume',
'field_type': 'string'
},
{
'field_label': u'SciELO ISSN',
'field_name': 'loaded_data.scielo_issn',
'field_label': u'Number',
'field_name': 'loaded_data__number',
'field_type': 'string'
},
{
'field_label': u'Type',
'field_name': 'loaded_data__type',
'field_type': 'string'
},
{
Expand Down

0 comments on commit 407d32c

Please sign in to comment.