[develop]: Change OA Indicator to show percentage of OA for the last full year.
This commit is contained in:
parent
3f883248d2
commit
f61308d2d5
|
@ -1 +1 @@
|
|||
Subproject commit c7628584277d8a81274ef40a58e908df988a5e58
|
||||
Subproject commit ebff30414f3e62a2a44ee5fa98ae314b16cec789
|
|
@ -63,7 +63,7 @@
|
|||
<div class="uk-grid" class="uk-child-width-1-4@l uk-child-width-1-3@m uk-child-width-1-1"
|
||||
uk-grid uk-height-match="target: .top-info;">
|
||||
<div *ngFor="let item of filteredStakeholders.slice((currentPage-1)*pageSize, currentPage*pageSize)">
|
||||
<a routerLink="./{{item.alias}}" class="uk-link-reset">
|
||||
<a [routerLink]="['./', item.alias]" class="uk-link-reset">
|
||||
<div class="uk-card uk-card-default uk-card-hover">
|
||||
<div class="uk-padding-small top-info">
|
||||
<!-- logo -->
|
||||
|
@ -91,7 +91,7 @@
|
|||
<!-- when OA badges are re-introduced, the below if-statement will have to be moved on its correct div -->
|
||||
<div *ngIf="item.funderType || item.openAccess"
|
||||
class="uk-card-footer uk-padding-small uk-background-muted">
|
||||
<div class="uk-grid uk-grid-divider uk-flex-center uk-flex-middle uk-child-width-1-2@m"
|
||||
<div class="uk-grid uk-grid-small uk-grid-divider uk-flex-center uk-flex-middle uk-child-width-1-2@m"
|
||||
uk-grid>
|
||||
<div *ngIf="item.funderType">
|
||||
<div class="uk-text-xsmall">
|
||||
|
@ -109,10 +109,10 @@
|
|||
<progress
|
||||
class="uk-progress open-access uk-margin-xsmall-top uk-margin-xsmall-bottom"
|
||||
[value]="item.openAccess" max="100"></progress>
|
||||
<div class="uk-flex uk-flex-middle" uk-tooltip="Open Access with Licence">
|
||||
<div class="uk-flex uk-text-center uk-flex-middle" [attr.uk-tooltip]="'Open Access with Licence (' + year + ')'">
|
||||
<icon [name]="'open_access'" [flex]="true" [ratio]="0.8"
|
||||
class="open-access"></icon>
|
||||
<span class="uk-text-xsmall uk-margin-xsmall-left">Open Access</span>
|
||||
<span class="uk-text-xsmall uk-margin-xsmall-left">Open Access ({{year}})</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -134,13 +134,13 @@
|
|||
<th *ngIf="hasPublications"># of Publications</th>
|
||||
<th *ngIf="hasOpenAccess" class="uk-flex uk-flex-middle">
|
||||
<icon [name]="'open_access'" [flex]="true" [ratio]="0.8" class="open-access"></icon>
|
||||
<span class="uk-margin-xsmall-left">Open Access with Licence</span>
|
||||
<span class="uk-margin-xsmall-left">Open Access with Licence ({{year}})</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of filteredStakeholders.slice((currentPage-1)*pageSize, currentPage*pageSize)"
|
||||
class="clickable" routerLink="./{{item.alias}}">
|
||||
class="clickable" [routerLink]="['./', item.alias]">
|
||||
<td>
|
||||
<div class="uk-flex uk-flex-middle uk-height-xsmall uk-margin-left">
|
||||
<img *ngIf="item.logoUrl; else elseBlock" [src]="item | logoUrl"
|
||||
|
|
|
@ -66,4 +66,8 @@ export class BrowseStakeholdersComponent extends BrowseStakeholderBaseComponent<
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
get year() {
|
||||
return (new Date().getFullYear() - 1).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import {IrishMonitorService} from "../irish-monitor.service";
|
|||
[style]="'--percentage:' + percentage.toFixed(1)"></div>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-small-top">
|
||||
<icon class="open-access" [name]="'open_access'" [flex]="true"></icon>
|
||||
<span class="uk-margin-xsmall-left uk-text-small">Open Access with Licence</span>
|
||||
<span class="uk-margin-xsmall-left uk-text-small">Open Access with Licence ({{year}})</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -47,8 +47,8 @@ export class OaIndicatorComponent extends IndicatorStakeholderBaseComponent impl
|
|||
let OAIndicator: OAIndicator = this.stakeholderUtils.openAccess.get(this.stakeholder.type);
|
||||
if(OAIndicator) {
|
||||
this.subscriptions.push(zip(
|
||||
this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.numerator.source), this.indicatorUtils.getFullUrl(this.stakeholder, OAIndicator.numerator)),
|
||||
this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.denominator.source), this.indicatorUtils.getFullUrl(this.stakeholder, OAIndicator.denominator))).subscribe(res => {
|
||||
this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.numerator.source), this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, OAIndicator.numerator, null, this.year, this.year)),
|
||||
this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.denominator.source), this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, OAIndicator.denominator, null, this.year, this.year))).subscribe(res => {
|
||||
let numerator = this.calculate(res[0], OAIndicator.numerator.jsonPath);
|
||||
let denominator = this.calculate(res[1], OAIndicator.denominator.jsonPath);
|
||||
if (denominator > 0) {
|
||||
|
@ -58,6 +58,10 @@ export class OaIndicatorComponent extends IndicatorStakeholderBaseComponent impl
|
|||
}
|
||||
}
|
||||
|
||||
get year() {
|
||||
return (new Date().getFullYear() - 1).toString();
|
||||
}
|
||||
|
||||
public calculate(response: any, jsonPath: string[]) {
|
||||
let result = JSON.parse(JSON.stringify(response));
|
||||
jsonPath.forEach(path => {
|
||||
|
|
Loading…
Reference in New Issue