Skip to content
Permalink
Browse files

Merge pull request #725 from Royal-Society-of-New-Zealand/ORCIDHUB-46…

…0/469

Orcidhub 460/469
  • Loading branch information...
rpaw053 committed Aug 14, 2019
2 parents 1ea58e6 + f3f10c9 commit 16a37f13554eafd7016da48ae228f2a9eea56955
@@ -305,7 +305,7 @@ class WorkForm(FlaskForm):
short_description = TextAreaField(description="Short Description")
citation_type = SelectField(
choices=EMPTY_CHOICES + models.citation_type_choices, description="Citation Type")
citation = StringField("Citation Value")
citation = TextAreaField("Citation Value")
publication_date = PartialDateField("Publication date")
url = StringField("Url")
language_code = LanguageSelectField("Language used in this form")

Large diffs are not rendered by default.

@@ -412,11 +412,7 @@ def create_or_update_work(self, task_by_user, *args, **kwargs):
rec.type = wr.type.replace('_', '-').lower()

if wr.publication_date:
publication_date = wr.publication_date.as_orcid_dict()
# TODO:Fix media-type once ORCID starts supporting it again. If not then delete this commented code.
"""if wr.publication_media_type:
publication_date['media-type'] = wr.publication_media_type.upper()"""
rec.publication_date = publication_date
rec.publication_date = wr.publication_date.as_orcid_dict()

external_ids = []
contributors = []
@@ -628,7 +628,6 @@ class RecordModelView(AppModelView):
]
column_export_exclude_list = (
"task",
"is_active",
)
can_edit = True
can_create = False
@@ -986,7 +985,6 @@ class CompositeRecordModelView(RecordModelView):

column_export_exclude_list = (
"task",
"is_active",
"status",
"processed_at",
"created_at",
@@ -1019,17 +1017,17 @@ def _export_tablib(self, export_type, return_url):
['invitees', 'review_group_id', 'review_url', 'reviewer_role', 'review_type',
'review_completion_date', 'subject_external_identifier', 'subject_container_name',
'subject_type', 'subject_name', 'subject_url', 'convening_organization',
'review_identifiers']]
'review_identifiers', 'is_active']]
elif self.model == FundingRecord:
self._export_columns = [(v, v.replace('_', '-')) for v in
['invitees', 'title', 'type', 'organization_defined_type', 'short_description',
'amount', 'url', 'start_date', 'end_date', 'organization', 'contributors',
'external_ids']]
'external_ids', 'is_active']]
elif self.model == WorkRecord:
self._export_columns = [(v, v.replace('_', '-')) for v in
['invitees', 'title', 'journal_title', 'short_description', 'citation', 'type',
'publication_date', 'url', 'language_code', 'country', 'contributors',
'external_ids']]
'external_ids', 'is_active']]
ds = tablib.Dataset(headers=[c[1] for c in self._export_columns])

count, data = self._export_data()
@@ -1141,8 +1139,9 @@ def expected_format(self, row):
vals.append(amount_dict)
elif c[0] == "citation":
citation_dict = dict()
citation_dict['citation-type'] = self.get_export_value(row, 'citation_type')
citation_dict['citation-value'] = csv_encode(self.get_export_value(row, 'citation_value'))
if self.get_export_value(row, 'citation_type'):
citation_dict['citation-type'] = self.get_export_value(row, 'citation_type')
citation_dict['citation-value'] = csv_encode(self.get_export_value(row, 'citation_value'))
vals.append(citation_dict)
elif c[0] == "contributors":
contributors_list = []
@@ -1273,7 +1272,8 @@ class FundingRecordAdmin(CompositeRecordModelView):
"external_id_type",
"external_id_url",
"external_id_relationship",
"status",)
"status",
"is_active")

def get_record_list(self, page, sort_column, sort_desc, search, filters, execute=True, page_size=None):
"""Return records and realated to the record data."""
@@ -1334,7 +1334,6 @@ class WorkRecordAdmin(CompositeRecordModelView):
"citation_value",
"type",
"publication_date",
"publication_media_type",
"url",
"language_code",
"country",
@@ -1348,6 +1347,7 @@ class WorkRecordAdmin(CompositeRecordModelView):
"external_id_url",
"external_id_relationship",
"status",
"is_active"
]

def get_record_list(self, page, sort_column, sort_desc, search, filters, execute=True, page_size=None):
@@ -1451,6 +1451,7 @@ class PeerReviewRecordAdmin(CompositeRecordModelView):
"peer_review_id",
"external_id_url",
"external_id_relationship",
"is_active"
]

def get_record_list(self,
@@ -1511,7 +1512,6 @@ class AffiliationRecordAdmin(RecordModelView):
)
column_export_exclude_list = (
"task",
"is_active",
)
form_widget_args = {"task": {"readonly": True}}

@@ -2147,10 +2147,7 @@ def edit_record(user_id, section_type, put_code=None):
citation=_data.get("citation", "citation-value"),
url=_data.get("url", "value"),
language_code=_data.get("language-code"),
# Removing key 'media-type' from the publication_date dict.
publication_date=PartialDate.create(
{date_key: _data.get("publication-date")[date_key] for date_key in
('day', 'month', 'year')}) if _data.get("publication-date") else None,
publication_date=PartialDate.create(_data.get("publication-date")),
country=_data.get("country", "value"),
visibility=(_data.get("visibility", default='') or '').upper())
else:
@@ -93,6 +93,8 @@ mapping:
type: str
currency-code:
type: str
is-active:
type: str
url:
type: map
mapping:
@@ -32,6 +32,8 @@ mapping:
mapping:
value:
type: timestamp
is-active:
type: str
source:
type: map
mapping:
@@ -32,6 +32,8 @@ mapping:
mapping:
value:
type: timestamp
is-active:
type: str
source:
type: map
mapping:
@@ -116,8 +118,6 @@ mapping:
mapping:
value:
type: str
media-type:
type: str
external-ids:
type: map
mapping:
@@ -17,8 +17,7 @@
"publication-date": {
"year": {"value": "2001"},
"month": {"value": "1"},
"day": {"value": "12"},
"media-type": null
"day": {"value": "12"}
},
"external-ids": {
"external-id": [{
@@ -3680,8 +3680,7 @@ def test_researcher_work(client, mocker):
"publication-date": {
"year": {"value": "2001"},
"month": {"value": "1"},
"day": {"value": "12"},
"media-type": null
"day": {"value": "12"}
},
"external-ids": {
"external-id": [{

0 comments on commit 16a37f1

Please sign in to comment.
You can’t perform that action at this time.