Skip to content
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

Better handling of missing DOIs when outputting Crossref metadata (#551, #565) #627

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

rhigman
Copy link
Member

@rhigman rhigman commented Sep 9, 2024

Fixes #551 and #565. Solution implemented for #551 was to exclude chapters without DOIs from existing Crossref output, rather than making a new output (as discussed in issue comments).

@@ -79,14 +79,25 @@ impl XmlSpecification for DoiDepositCrossref {

impl XmlElementBlock<DoiDepositCrossref> for Work {
fn xml_element<W: Write>(&self, w: &mut EventWriter<W>) -> ThothResult<()> {
let work_type = match &self.work_type {
let work = self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was introduced earlier, but I don't think it's necessary to declare this variable

"Missing chapter DOI".to_string(),
));
// Caller should only pass in chapters which have DOIs
unreachable!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can now get rid off this condition and simply unwrap the DOI

let doi = chapter
        .related_work
        .doi
        .as_ref()
        .expect("Caller should only pass in chapters which have DOIs");
        ```

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, nice :)

@rhigman rhigman requested a review from ja573 September 9, 2024 15:08
@rhigman rhigman merged commit eab0663 into develop Sep 10, 2024
12 checks passed
@rhigman rhigman deleted the feature/551_565_crossref_dois branch September 10, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants