This repository was archived by the owner on Apr 14, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export interface KeenConfig {
1919
2020declare const config : {
2121 WATER_BUTLER_ENABLED : boolean ;
22- PREPRINT_ADAPTER_OPTIONS_ENABLED : boolean ;
2322 plauditWidgetUrl : string ,
2423 environment : any ;
2524 cedarConfig : any ;
Original file line number Diff line number Diff line change @@ -60,20 +60,31 @@ export default class PreprintsDetail extends Route {
6060 'contributors' ,
6161 'identifiers' ,
6262 ] ;
63- const adapterOptions = config . PREPRINT_ADAPTER_OPTIONS_ENABLED ? Object ( {
64- query : {
65- 'metrics[views]' : 'total' ,
66- 'metrics[downloads]' : 'total' ,
67- } ,
68- } ) : undefined ;
6963
7064
7165 const preprint = await this . store . findRecord ( 'preprint' , guid , {
7266 reload : true ,
7367 include : embeddableFields ,
74- adapterOptions,
7568 } ) ;
7669
70+ let apiMetrics ;
71+ try {
72+ const adapterOptions = Object ( {
73+ query : {
74+ 'metrics[views]' : 'total' ,
75+ 'metrics[downloads]' : 'total' ,
76+ } ,
77+ } ) ;
78+
79+ const preprintMetrics = await this . store . findRecord ( 'preprint' , guid , {
80+ reload : true ,
81+ adapterOptions,
82+ } ) ;
83+
84+ apiMetrics = preprintMetrics . apiMetrics ;
85+ // eslint-disable-next-line
86+ } catch ( _ ) { }
87+
7788 const provider = await preprint ?. get ( 'provider' ) ;
7889
7990 this . theme . set ( 'providerType' , 'preprint' ) ;
@@ -123,6 +134,7 @@ export default class PreprintsDetail extends Route {
123134
124135 return {
125136 preprint,
137+ apiMetrics,
126138 brand : provider . brand . content ,
127139 contributors,
128140 provider,
Original file line number Diff line number Diff line change 197197 <span data-test-view-count-label>
198198 {{ t ' preprints.detail.share.views' }} :
199199 </span >
200- <span data-test-view-count> {{ this.model.preprint. apiMeta.metrics.views }} </span > |
200+ <span data-test-view-count> {{ this.model.apiMeta ? .metrics ? .views }} </span > |
201201 <span data-test-download-count-label>
202202 {{ t ' preprints.detail.share.downloads' }} :
203203 </span >
204- <span data-test-download-count>{{ this.model.preprint. apiMeta.metrics.downloads }} </span >
204+ <span data-test-download-count>{{ this.model.apiMeta ? .metrics ? .downloads }} </span >
205205 <EmberTooltip >
206206 {{ t ' preprints.detail.share.metrics_disclaimer' }} {{ moment-format this.metricsStartDate ' YYYY-MM-DD' }}
207207 </EmberTooltip >
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ const {
6262 KEEN_CONFIG : keenConfig ,
6363 LINT_ON_BUILD : lintOnBuild = false ,
6464 WATER_BUTLER_ENABLED = true ,
65- PREPRINT_ADAPTER_OPTIONS_ENABLED = true ,
6665 MIRAGE_ENABLED = false ,
6766 MIRAGE_SCENARIOS = [
6867 'cedar' ,
@@ -119,7 +118,6 @@ module.exports = function(environment) {
119118 modulePrefix : 'ember-osf-web' ,
120119 cedarConfig,
121120 WATER_BUTLER_ENABLED ,
122- PREPRINT_ADAPTER_OPTIONS_ENABLED ,
123121 plauditWidgetUrl,
124122 environment,
125123 lintOnBuild,
You can’t perform that action at this time.
0 commit comments