From 0d75307c761c3c12e8fd779ecdbd779b64b783de Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 8 Nov 2023 14:12:50 +0200 Subject: [PATCH 1/3] [develop | DONE | CHANGED]: parsingFunctions.class.ts: Remove old schema parsing for impact based indicators (old was A, B, C - new is C1-C5). --- landingPages/landing-utils/parsingFunctions.class.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index cad44497..64a855c3 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -902,10 +902,6 @@ export class ParsingFunctions { metric.value = 'Top 1%'; } else if (element.class == 'C4') { metric.value = 'Top 10%'; - } else if (element.class == 'A') { - metric.value = 'Exceptional'; - } else if (element.class == 'B') { - metric.value = 'Substantial'; } else { metric.value = 'Average'; } @@ -922,10 +918,6 @@ export class ParsingFunctions { metric.value = 'Top 1%'; } else if (element.class == 'C4') { metric.value = 'Top 10%'; - } else if (element.class == 'A') { - metric.value = 'Exceptional'; - } else if (element.class == 'B') { - metric.value = 'Substantial'; } else { metric.value = 'Average'; } @@ -942,10 +934,6 @@ export class ParsingFunctions { metric.value = 'Top 1%'; } else if (element.class == 'C4') { metric.value = 'Top 10%'; - } else if (element.class == 'A') { - metric.value = 'Exceptional'; - } else if (element.class == 'B') { - metric.value = 'Substantial'; } else { metric.value = 'Average'; } -- 2.17.1 From 32a34d5a1222c96137bec1f5b93bbbba685cf41e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 8 Nov 2023 16:57:56 +0200 Subject: [PATCH 2/3] [develop | DONE | ADDED]: Added parsing and display for usage counts per data source. 1. resultLandingInfo.ts: a. Commented out deprecated fields from interface Measure. b. Added interface MetricPerDatasource. c. Added in interface Measure, countsPerDatasource?: MetricPerDatasource[]; 2. parsingFunctions.class.ts: In method "parseMeasures()", added parsing for usage counts per data source (countsPerDatasource). 3. resultLanding.component.html: Display countsPerDatasource in table (metrics tab > usage tab) if there is any. --- .../landing-utils/parsingFunctions.class.ts | 53 +++++++++++++++---- .../result/resultLanding.component.html | 18 +++++++ utils/entities/resultLandingInfo.ts | 32 ++++++----- 3 files changed, 82 insertions(+), 21 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 64a855c3..a34ba066 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,5 +1,5 @@ import {HostedByCollectedFrom, Project, RelationResult} from "../../utils/result-preview/result-preview"; -import {Context, Measure, Metric, Reference} from "../../utils/entities/resultLandingInfo"; +import {Context, Measure, Metric, MetricPerDatasource, Reference} from "../../utils/entities/resultLandingInfo"; import {Injectable} from '@angular/core'; import {properties} from "../../../../environments/environment"; import {StringUtils} from "../../utils/string-utils.class"; @@ -878,19 +878,43 @@ export class ParsingFunctions { if (elements && elements.length) { let bip: Metric[] = []; let counts: Metric[] = []; + let countsPerDatasource: MetricPerDatasource[] = []; let measure: Measure = {}; + + let datasourcePosition: Map = new Map(); + + let views: number = 0; + let downloads: number = 0; elements.forEach(element => { if (element.id == 'views') { - counts.push({name: 'views', icon: 'visibility', value: element.count, order: 0}); - measure.views = element.count; + views += element.count; + let datasourceId = element.datasource; + if(datasourceId) { + if(datasourcePosition.has(element.datasource)) { + countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count; + } else { + datasourcePosition.set(element.datasource, countsPerDatasource.length); + countsPerDatasource.push({"datasourceId": element.datasource, "views": element.count, "downloads": 0}) + } + } + // measure.views = element.count; } if (element.id == 'downloads') { - counts.push({name: 'downloads', icon: 'download', value: element.count, order: 1}); - measure.downloads = element.count; + downloads += element.count; + let datasourceId = element.datasource; + if(datasourceId) { + if(datasourcePosition.has(element.datasource)) { + countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count; + } else { + datasourcePosition.set(element.datasource, countsPerDatasource.length); + countsPerDatasource.push({"datasourceId": element.datasource, "views": 0, "downloads": element.count}) + } + } + // measure.downloads = element.count; } if (element.id == 'influence_alt' || element.id == 'citation_count') { bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2}); - measure.citations = element.score; + // measure.citations = element.score; } if (element.id == 'popularity') { let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3}; @@ -905,7 +929,7 @@ export class ParsingFunctions { } else { metric.value = 'Average'; } - measure.popularity = metric.value; + // measure.popularity = metric.value; bip.push(metric); } if (element.id == 'influence') { @@ -921,7 +945,7 @@ export class ParsingFunctions { } else { metric.value = 'Average'; } - measure.influence = metric.value; + // measure.influence = metric.value; bip.push(metric); } if (element.id == 'impulse') { @@ -937,10 +961,21 @@ export class ParsingFunctions { } else { metric.value = 'Average'; } - measure.impulse = metric.value; + // measure.impulse = metric.value; bip.push(metric); } }); + + if(views > 0) { + counts.push({name: 'views', icon: 'visibility', value: views, order: 0}); + } + if(downloads > 0) { + counts.push({name: 'downloads', icon: 'download', value: downloads, order: 1}); + } + if(countsPerDatasource && countsPerDatasource.length > 0) { + measure.countsPerDatasource = countsPerDatasource; + } + measure.bip = bip.sort((a, b) => a.order - b.order); measure.counts = counts.sort((a, b) => a.order - b.order); return measure; diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 6df0320b..ca097000 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -1240,6 +1240,24 @@ +
+ + + + + + + + + + + + + + + +
Data sourceViewsDownloads
{{datasource.datasourceId}}{{datasource.views}}{{datasource.downloads}}
+
Powered by diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 30e1e76b..8a45393b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -30,20 +30,28 @@ export interface Context { } export interface Measure { - /** @deprecated*/ - downloads?: string; - /** @deprecated*/ - views?: string; - /** @deprecated*/ - influence?: string; - /** @deprecated*/ - popularity?: string; - /** @deprecated*/ - citations?: string; - /** @deprecated*/ - impulse?: string; + // /** @deprecated*/ + // downloads?: string; + // /** @deprecated*/ + // views?: string; + // /** @deprecated*/ + // influence?: string; + // /** @deprecated*/ + // popularity?: string; + // /** @deprecated*/ + // citations?: string; + // /** @deprecated*/ + // impulse?: string; bip?: Metric[] counts?: Metric[] + countsPerDatasource?: MetricPerDatasource[]; +} + +export interface MetricPerDatasource { + datasourceId: string, + // datasourceName: string, + views: number, + downloads: number } export interface Metric { -- 2.17.1 From 68c352d3d275209d52bc3198dad7482ee21d193d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 8 Nov 2023 22:40:04 +0200 Subject: [PATCH 3/3] [develop | DONE | CHANGED]: In deposit page, move "Go to repository" button to top, aligned with the title when possible. 1. searchResultsForOrcid.component.html & searchMyOrcidResults.component.html: Removed [promoteWebsiteURL]="true", since this should be true only in deposit cards. 2. searchResultsInDeposit.component.ts: Added @Input() isMobile: boolean = false; 3. searchResultsInDeposit.component.html: Set parameter [isMobile]="isMobile" to . 4. newSearchPage.component.html: Set parameter [isMobile]="mobile" to . 5. result-preview.component.html: In deposit cards align on the right of the title the "Go to repository" button and in mobile screens show it on the top right of the card. --- deposit/searchResultsInDeposit.component.html | 2 +- deposit/searchResultsInDeposit.component.ts | 1 + .../searchMyOrcidResults.component.html | 2 +- .../searchResultsForOrcid.component.html | 2 +- .../searchUtils/newSearchPage.component.html | 3 +- .../result-preview.component.html | 120 ++++++++++-------- 6 files changed, 73 insertions(+), 57 deletions(-) diff --git a/deposit/searchResultsInDeposit.component.html b/deposit/searchResultsInDeposit.component.html index cfd55620..d622be32 100644 --- a/deposit/searchResultsInDeposit.component.html +++ b/deposit/searchResultsInDeposit.component.html @@ -19,7 +19,7 @@
  • + [isCard]="true" deposit="true" [isMobile]="isMobile">
  • diff --git a/deposit/searchResultsInDeposit.component.ts b/deposit/searchResultsInDeposit.component.ts index cfe75527..34e9ae46 100644 --- a/deposit/searchResultsInDeposit.component.ts +++ b/deposit/searchResultsInDeposit.component.ts @@ -19,6 +19,7 @@ export class SearchResultsInDepositComponent { @Input() status: number; @Input() type: string; @Input() properties:EnvProperties; + @Input() isMobile: boolean = false; public urlParam: string; diff --git a/orcid/my-orcid-links/searchMyOrcidResults.component.html b/orcid/my-orcid-links/searchMyOrcidResults.component.html index 4cbd7292..c1d1ede4 100644 --- a/orcid/my-orcid-links/searchMyOrcidResults.component.html +++ b/orcid/my-orcid-links/searchMyOrcidResults.component.html @@ -23,7 +23,7 @@