[develop]: Change extract stakeholders by removing condition for field name.
This commit is contained in:
parent
1401a68256
commit
c97c54208f
|
@ -772,45 +772,6 @@ export class IndicatorUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractStakeHolders(obj, stakeholder: Stakeholder) {
|
private extractStakeHolders(obj, stakeholder: Stakeholder) {
|
||||||
this.extractFunder(obj, stakeholder);
|
|
||||||
this.extractRI(obj, stakeholder);
|
|
||||||
this.extractOrganization(obj, stakeholder);
|
|
||||||
this.extractDatasource(obj, stakeholder);
|
|
||||||
this.extractResearcher(obj, stakeholder);
|
|
||||||
this.extractPublisher(obj, stakeholder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractFunder(obj, stakeholder: Stakeholder) {
|
|
||||||
if (stakeholder.type != 'funder') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
|
||||||
if (query["query"]["profile"]) {
|
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
|
||||||
}
|
|
||||||
if (!query["query"]["filters"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let filter of query["query"]["filters"]) {
|
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
|
||||||
//ignore field No Of Funders
|
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
|
||||||
if ((gfilter["field"].indexOf(" funder") != -1 && gfilter["field"].indexOf(" funders") == -1) ||
|
|
||||||
(gfilter["field"].indexOf(".funder") != -1) ||
|
|
||||||
(gfilter["field"].indexOf(".funder.id") != -1)) {
|
|
||||||
gfilter["values"][0] = replacedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractRI(obj, stakeholder: Stakeholder) {
|
|
||||||
if (stakeholder.type != 'ri') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
||||||
if (query["query"]["profile"]) {
|
if (query["query"]["profile"]) {
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
||||||
|
@ -822,116 +783,7 @@ export class IndicatorUtils {
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
for (let gfilter of filter["groupFilters"]) {
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
||||||
if ((gfilter["field"].indexOf(".context.name") != -1)
|
|
||||||
|| (gfilter["field"].indexOf(".context.id") != -1)) {
|
|
||||||
gfilter["values"][0] = replacedValue;
|
gfilter["values"][0] = replacedValue;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractOrganization(obj, stakeholder: Stakeholder) {
|
|
||||||
// works for publication.project.organization.name
|
|
||||||
// and publication.organization.name
|
|
||||||
if (stakeholder.type != 'organization') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
|
||||||
if (query["query"]["profile"]) {
|
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
|
||||||
}
|
|
||||||
if (!query["query"]["filters"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let filter of query["query"]["filters"]) {
|
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
|
||||||
if ((gfilter["field"].indexOf(".organization.name") != -1) ||
|
|
||||||
(gfilter["field"].indexOf(".organization.id") != -1)) {
|
|
||||||
gfilter["values"][0] = replacedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractPublisher(obj, stakeholder: Stakeholder) {
|
|
||||||
// works for .publisher
|
|
||||||
if (stakeholder.type != 'publisher') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
|
||||||
if (query["query"]["profile"]) {
|
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
|
||||||
}
|
|
||||||
if (!query["query"]["filters"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let filter of query["query"]["filters"]) {
|
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
|
||||||
console.log(replacedValue)
|
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
|
||||||
if (gfilter["field"].indexOf(".publisher") != -1) {
|
|
||||||
console.log(gfilter["values"][0])
|
|
||||||
gfilter["values"][0] = replacedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractDatasource(obj, stakeholder: Stakeholder) {
|
|
||||||
// works for .datasource.name and .HostedBy datasource
|
|
||||||
// and .datasource.id
|
|
||||||
if (stakeholder.type != 'datasource' && stakeholder.type != 'journal') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
|
||||||
if (query["query"]["profile"]) {
|
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
|
||||||
}
|
|
||||||
if (!query["query"]["filters"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let filter of query["query"]["filters"]) {
|
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
|
||||||
if ((gfilter["field"].indexOf(".datasource.name") != -1 || gfilter["field"].indexOf(".HostedBy datasource") != -1) ||
|
|
||||||
(gfilter["field"].indexOf(".datasource.id") != -1) || (gfilter["field"].indexOf(".hostedby") != -1)) {
|
|
||||||
gfilter["values"][0] = replacedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private extractResearcher(obj, stakeholder: Stakeholder) {
|
|
||||||
// works for .orcid
|
|
||||||
if (stakeholder.type != "researcher") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
|
|
||||||
if (query["query"]["profile"]) {
|
|
||||||
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
|
|
||||||
}
|
|
||||||
if (!query["query"]["filters"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let filter of query["query"]["filters"]) {
|
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
|
||||||
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder);
|
|
||||||
if (replacedValue) { // don't proceed in replacement if no replaced value matches
|
|
||||||
if ((gfilter["field"].indexOf(".orcid") != -1)) {
|
|
||||||
gfilter["values"][0] = replacedValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue