Skip to content

Commit

Permalink
Merge pull request #810 from datacite/752_cites_fix
Browse files Browse the repository at this point in the history
Cites/IsCitedBy fix
  • Loading branch information
digitaldogsbody authored May 16, 2022
2 parents 4b08b82 + 766596f commit 344ccde
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class Event < ApplicationRecord
].freeze

# renamed to make it clearer that these relation types are grouped together as references
REFERENCE_RELATION_TYPES = %w[is-cited-by is-supplement-to references].freeze
REFERENCE_RELATION_TYPES = %w[cites is-supplement-to references].freeze

# renamed to make it clearer that these relation types are grouped together as citations
CITATION_RELATION_TYPES = %w[cites is-supplemented-by is-referenced-by].freeze
CITATION_RELATION_TYPES = %w[is-cited-by is-supplemented-by is-referenced-by].freeze

RELATIONS_RELATION_TYPES = %w[
compiles
Expand Down Expand Up @@ -1029,23 +1029,6 @@ def set_source_and_target_doi
self.source_relation_type_id = "parts"
self.target_relation_type_id = "part_of"
end

## If the two DOI's involved are Cody and Mike's intro blog posts
## _AND_ is a cites/is-cited-by, then switch for testing
if (subj_id == "https://doi.org/10.5438/sjx9-hb16" && obj_id == "https://doi.org/10.5438/cq8g-b226") || (obj_id == "https://doi.org/10.5438/sjx9-hb16" && subj_id == "https://doi.org/10.5438/cq8g-b226")
if relation_type_id == "is-cited-by"
self.source_doi = uppercase_doi_from_url(obj_id)
self.target_doi = uppercase_doi_from_url(subj_id)
self.source_relation_type_id = "references"
self.target_relation_type_id = "citations"
elsif relation_type_id == "cites"
self.source_doi = uppercase_doi_from_url(subj_id)
self.target_doi = uppercase_doi_from_url(obj_id)
self.source_relation_type_id = "references"
self.target_relation_type_id = "citations"
end
end
## END TEST ##
end

def set_defaults
Expand Down

0 comments on commit 344ccde

Please sign in to comment.