Skip to content

Commit

Permalink
handle facets for citation_year
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 20, 2021
1 parent 0e03bcb commit 566bce7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def index
end
citation_years =
if total.positive?
facet_annual(response.response.aggregations.citation_years.buckets)
facet_by_cumulative_year(response.response.aggregations.citation_years.buckets)
end
prefixes =
if total.positive?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/old_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def index
end
citation_years =
if total > 0
facet_annual(response.aggregations.citation_years.buckets)
facet_by_cumulative_year(response.aggregations.citation_years.buckets)
end
citation_types =
if total > 0
Expand Down
11 changes: 2 additions & 9 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -958,17 +958,10 @@ def obj_cache_key
end

def citation_year
unless (INCLUDED_RELATION_TYPES + RELATIONS_RELATION_TYPES).include?(
relation_type_id,
)
""
end
subj_publication =
subj["datePublished"] || subj["date_published"] ||
(date_published(subj_id) || year_month)
subj["datePublished"] || subj["date_published"]
obj_publication =
obj["datePublished"] || obj["date_published"] ||
(date_published(obj_id) || year_month)
obj["datePublished"] || obj["date_published"]
[subj_publication[0..3].to_i, obj_publication[0..3].to_i].max
end

Expand Down

0 comments on commit 566bce7

Please sign in to comment.