Added edge case for total data scope.
MODIFY
src/server/rest/v1/service/StatisticService.ts
src/server/rest/v1/service/StatisticService.ts
@@ -401,10 +401,10 @@ export default class StatisticService {
filter.chargeBoxIDs = filteredRequest.ChargingStationID.split('|');
}
// DataScope
- if (filteredRequest.DataScope) {
- filter.dataScope = filteredRequest.DataScope;
- } else {
+ if (filteredRequest.DataScope === StatsDataScope.TOTAL || !filteredRequest.DataScope) {
filter.dataScope = StatsDataScope.MONTH;
+ } else {
+ filter.dataScope = filteredRequest.DataScope;
}
// User
if (Authorizations.isBasic(loggedUser)) {

MODIFY
src/types/Statistic.ts
src/types/Statistic.ts
@@ -48,7 +48,8 @@ export enum StatsDataScope {
DATE = 'date',
DAY_OF_MONTH = 'dayOfMonth',
DAY_OF_WEEK = 'dayOfWeek',
- TOTAL = 'sum',
+ SUM = 'sum',
+ TOTAL = 'total',
DAY_OF_YEAR = 'dayOfYear',
HOUR = 'hour'
}

Added edge case for total data scope.