|
180 | 180 | doi = validate_doi(params[:id])
|
181 | 181 | link = doi ? "https://doi.org/#{doi}" : params[:id]
|
182 | 182 |
|
183 |
| - # events = {} |
184 |
| - # result = Benchmark.measure do |
185 |
| - events = get_events('page[size]' => 1, 'page[number]' => @page, 'doi' => doi, 'sort' => 'relation_type_id') |
186 |
| - # end |
187 |
| - # logger.info "[GetEvents] for /works/#{params["id"]} took #{(result.total * 1000).to_i} ms" |
188 |
| - |
189 |
| - @work[:metrics] = reduce_aggs(events[:meta], { yop: @work.dig(:data, "attributes","published").to_i }) |
190 |
| - @work[:metrics].merge!(citations: (events[:meta].fetch('uniqueCitations', []).find { |x| x['id'] == doi } || {})) |
191 |
| - @work[:metrics].merge!(citations_histogram: events[:meta].fetch('citationsHistogram', {})) |
192 |
| - @work[:metrics].merge!(views_histogram: events[:meta].fetch('viewsHistogram', {})) |
193 |
| - @work[:metrics].merge!(downloads_histogram: events[:meta].fetch('downloadsHistogram', {})) |
| 183 | + # # events = {} |
| 184 | + # # result = Benchmark.measure do |
| 185 | + # events = get_events('page[size]' => 1, 'page[number]' => @page, 'doi' => doi, 'sort' => 'relation_type_id') |
| 186 | + # # end |
| 187 | + # # logger.info "[GetEvents] for /works/#{params["id"]} took #{(result.total * 1000).to_i} ms" |
| 188 | + |
| 189 | + # @work[:metrics] = reduce_aggs(events[:meta], { yop: @work.dig(:data, "attributes","published").to_i }) |
| 190 | + # @work[:metrics].merge!(citations: (events[:meta].fetch('uniqueCitations', []).find { |x| x['id'] == doi } || {})) |
| 191 | + # @work[:metrics].merge!(citations_histogram: events[:meta].fetch('citationsHistogram', {})) |
| 192 | + # @work[:metrics].merge!(views_histogram: events[:meta].fetch('viewsHistogram', {})) |
| 193 | + # @work[:metrics].merge!(downloads_histogram: events[:meta].fetch('downloadsHistogram', {})) |
194 | 194 | # @work[:relation_types] = events[:meta].fetch('relationTypes', [])
|
195 | 195 |
|
196 | 196 | # check for existing claims if user is logged in and work is registered with DataCite
|
|
0 commit comments