@sap-ux/fe-mockserver-core
Advanced tools
Comparing version 1.1.84 to 1.1.85
@@ -815,39 +815,41 @@ "use strict"; | ||
}); | ||
const aggregateDefinition = applyDefinition.subTransformations[0]; | ||
aggregateDefinition.aggregateDef.forEach((subAggregateDefinition) => { | ||
let propValue; | ||
if (subAggregateDefinition.operator === undefined && | ||
mockData && | ||
mockData.hasCustomAggregate(subAggregateDefinition.name, odataRequest)) { | ||
propValue = mockData.performCustomAggregate(subAggregateDefinition.name, dataToAggregate, odataRequest); | ||
} | ||
else { | ||
dataToAggregate.forEach((dataLine) => { | ||
const currentValue = dataLine[subAggregateDefinition.sourceProperty]; | ||
if (propValue === undefined) { | ||
propValue = currentValue; | ||
} | ||
else { | ||
switch (subAggregateDefinition.operator) { | ||
case 'max': | ||
propValue = Math.max(propValue, currentValue); | ||
break; | ||
case 'min': | ||
propValue = Math.min(propValue, currentValue); | ||
break; | ||
case 'average': | ||
propValue += currentValue; | ||
break; | ||
default: | ||
propValue += currentValue; | ||
break; | ||
if (applyDefinition.subTransformations.length > 0) { | ||
const aggregateDefinition = applyDefinition.subTransformations[0]; | ||
aggregateDefinition.aggregateDef.forEach((subAggregateDefinition) => { | ||
let propValue; | ||
if (subAggregateDefinition.operator === undefined && | ||
mockData && | ||
mockData.hasCustomAggregate(subAggregateDefinition.name, odataRequest)) { | ||
propValue = mockData.performCustomAggregate(subAggregateDefinition.name, dataToAggregate, odataRequest); | ||
} | ||
else { | ||
dataToAggregate.forEach((dataLine) => { | ||
const currentValue = dataLine[subAggregateDefinition.sourceProperty]; | ||
if (propValue === undefined) { | ||
propValue = currentValue; | ||
} | ||
} | ||
}); | ||
} | ||
if (subAggregateDefinition.operator === 'average') { | ||
propValue = propValue / dataToAggregate.length; | ||
} | ||
outData[subAggregateDefinition.name] = propValue; | ||
}); | ||
else { | ||
switch (subAggregateDefinition.operator) { | ||
case 'max': | ||
propValue = Math.max(propValue, currentValue); | ||
break; | ||
case 'min': | ||
propValue = Math.min(propValue, currentValue); | ||
break; | ||
case 'average': | ||
propValue += currentValue; | ||
break; | ||
default: | ||
propValue += currentValue; | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
if (subAggregateDefinition.operator === 'average') { | ||
propValue = propValue / dataToAggregate.length; | ||
} | ||
outData[subAggregateDefinition.name] = propValue; | ||
}); | ||
} | ||
return outData; | ||
@@ -854,0 +856,0 @@ }); |
{ | ||
"name": "@sap-ux/fe-mockserver-core", | ||
"version": "1.1.84", | ||
"version": "1.1.85", | ||
"description": "SAP Fiori OData - Fiori elements mock server core", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
545254
6304