Commit 87812cfd authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix a bug in the controller edit_insert (publication year).

The record.paper_year() has to be used instead of record.year() when the
record is published.
parent 104e20d7
......@@ -89,8 +89,9 @@ def free_run():
def edit_insert():
"""Edit an invenio record and insert it in the database.
@note: Recovery procedures are applied to fix basic non-conformity, but
no checks are run. The user is editing the record to fix problems.
Note:
Recovery procedures are applied to fix basic non-conformity, but
no checks are run. The user is editing the record to fix problems.
"""
if not current.app.inspirehep_institute_id:
......@@ -232,7 +233,13 @@ def edit_insert():
pass
values['PublicationsSubmitted'] = ', '.join(record.submitted())
values['PublicationsYear'] = record.year()
if record.is_published():
year = record.paper_year()
else:
year = record.year()
values['PublicationsYear'] = year
except Exception:
......
# -*- coding: utf-8 -*-
"""ARTICLE
http://inspirehep.net/record/11286523
Note:
* version 0.8.14 published date is wrong (2014 instead of 2015)
"""
import pytest
from harvest_tools import CheckAndFix
from invenio_tools import load_record
@pytest.fixture(scope="module")
def record():
return load_record('inspirehep.net', 1286523)
def test_paper_year(record):
assert record.paper_year() == "2015"
def test_submitted(record):
assert record.submitted() == ["2014-03-19"]
def test_year(record):
assert record.year() == "2014"
def test_check_years(record):
svc = CheckAndFix()
svc.submitted(record)
svc.year(record)
assert record.is_published() == True
assert record.submitted() == ["2014-03-19"]
assert record.year() == "2014"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment