-
Notifications
You must be signed in to change notification settings - Fork 11
fix(ep): fix approval request load and apprn handling #597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -323,10 +323,15 @@ def identifiers(self, identifiers): | |
| kept = [] | ||
| removed = [] | ||
| for id_entry in identifiers: | ||
| if id_entry.get("scheme") != "cdsrn": | ||
| scheme = id_entry.get("scheme") | ||
| identifier = id_entry.get("identifier", "") | ||
| # apprn belongs only on the public record. | ||
| if scheme == "apprn": | ||
| removed.append(identifier) | ||
| continue | ||
| elif scheme != "cdsrn": | ||
|
Comment on lines
+326
to
+332
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed apprn from restricted record |
||
| kept.append(id_entry) | ||
| continue | ||
| identifier = id_entry.get("identifier", "") | ||
| if not identifier.startswith(EP_APPROVAL_REPORT_NUMBER_PREFIX): | ||
| kept.append(id_entry) | ||
| continue | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,8 @@ def _metadata(self, dojson_entry, raw_dump_entry): | |
| # metadata["resource_type"]; see mappers/registry.py. | ||
| for mapper in METADATA_MAPPERS: | ||
| metadata[mapper.id] = mapper.map_value(ctx) | ||
| # Consume the key even if the value is later dropped. | ||
| dojson_entry.pop(mapper.id, None) | ||
| return {k: v for k, v in metadata.items() if v} | ||
|
Comment on lines
+192
to
194
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there's empty field we're having Unassigned metadata key error.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry it is not clear to me why do we need this change....
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty metadata (e.g. related_identifiers=[]) is filtered out or dropped in metadata, but without popping it stays in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can also change the _check_forgotten_keys method so it skips the empty values |
||
|
|
||
| def _custom_fields(self, dojson_entry, raw_dump_entry): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ApprovalRequestLoad needs parent.communities.default to pick the EP referee group. So it should be set before creating the request