Skip to content

Commit

Permalink
Merge pull request #1242 from datacite/doi-model-dry-code
Browse files Browse the repository at this point in the history
dry up code in app/models/doi.rb
  • Loading branch information
wendelfabianchinsamy authored Sep 12, 2024
2 parents 46a6e6a + f4babd0 commit 42d9c01
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ def reference_ids
end

def reference_count
reference_events.pluck(:target_doi).compact.map(&:downcase).uniq.length
reference_ids.length
end

def indexed_references
Expand All @@ -1290,7 +1290,7 @@ def citation_ids

# remove duplicate citing source dois
def citation_count
citation_events.pluck(:source_doi).compact.map(&:downcase).uniq.length
citation_ids.length
end

# remove duplicate citing source dois,
Expand All @@ -1311,7 +1311,7 @@ def part_ids
end

def part_count
part_events.pluck(:target_doi).compact.map(&:downcase).uniq.length
part_ids.length
end

def indexed_parts
Expand All @@ -1323,7 +1323,7 @@ def part_of_ids
end

def part_of_count
part_of_events.pluck(:source_doi).compact.map(&:downcase).uniq.length
part_of_ids.length
end

def indexed_part_of
Expand All @@ -1335,7 +1335,7 @@ def version_ids
end

def version_count
version_events.pluck(:target_doi).compact.map(&:downcase).uniq.length
version_ids.length
end

def indexed_versions
Expand All @@ -1347,7 +1347,7 @@ def version_of_ids
end

def version_of_count
version_of_events.pluck(:source_doi).compact.map(&:downcase).uniq.length
version_of_ids.length
end

def indexed_version_of
Expand Down

0 comments on commit 42d9c01

Please sign in to comment.