Added Low Inactivity + Low Consumption
MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -861,7 +861,7 @@ export default class TransactionService {
let projectFields = [
'id', 'chargeBoxID', 'timestamp', 'issuer', 'stateOfCharge', 'timezone', 'connectorId',
'meterStart', 'siteAreaID', 'siteID', 'errorCode', 'uniqueId', 'stop.totalConsumptionWh',
- 'stop.totalDurationSecs'
+ 'stop.totalDurationSecs', 'stop.stateOfCharge'
];
// Check Users
if ((await Authorizations.canListUsers(req.user)).authorized) {

MODIFY
src/server/rest/v1/service/UtilsService.ts
src/server/rest/v1/service/UtilsService.ts
@@ -731,9 +731,11 @@ export default class UtilsService {
TransactionInErrorType.LONG_INACTIVITY,
TransactionInErrorType.NEGATIVE_ACTIVITY,
TransactionInErrorType.NEGATIVE_DURATION,
+ TransactionInErrorType.LOW_DURATION,
// TransactionInErrorType.OVER_CONSUMPTION, // To much time consuming + to check if calculation is right
TransactionInErrorType.INVALID_START_DATE,
TransactionInErrorType.NO_CONSUMPTION,
+ TransactionInErrorType.LOW_CONSUMPTION,
TransactionInErrorType.MISSING_USER
];
if (Utils.isComponentActiveFromToken(user, TenantComponents.PRICING)) {

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -1262,9 +1262,14 @@ export default class TransactionStorage {
];
case TransactionInErrorType.NO_CONSUMPTION:
return [
- { $match: { 'stop.totalConsumptionWh': { $lte: 0 } } },
+ { $match: { 'stop.totalConsumptionWh': { $eq: 0 } } },
{ $addFields: { 'errorCode': TransactionInErrorType.NO_CONSUMPTION } }
];
+ case TransactionInErrorType.LOW_CONSUMPTION:
+ return [
+ { $match: { 'stop.totalConsumptionWh': { $lt: 1000 } } },
+ { $addFields: { 'errorCode': TransactionInErrorType.LOW_CONSUMPTION } }
+ ];
case TransactionInErrorType.NEGATIVE_ACTIVITY:
return [
{
@@ -1282,6 +1287,11 @@ export default class TransactionStorage {
{ $match: { 'stop.totalDurationSecs': { $lt: 0 } } },
{ $addFields: { 'errorCode': TransactionInErrorType.NEGATIVE_DURATION } }
];
+ case TransactionInErrorType.LOW_DURATION:
+ return [
+ { $match: { 'stop.totalDurationSecs': { $lt: 60 } } },
+ { $addFields: { 'errorCode': TransactionInErrorType.LOW_DURATION } }
+ ];
case TransactionInErrorType.INVALID_START_DATE:
return [
{ $match: { 'timestamp': { $lte: Utils.convertToDate('2017-01-01 00:00:00.000Z') } } },

MODIFY
src/types/InError.ts
src/types/InError.ts
@@ -29,10 +29,12 @@ export interface AssetInError extends Asset, InError {
export enum TransactionInErrorType {
NO_CONSUMPTION = 'no_consumption',
+ LOW_CONSUMPTION = 'low_consumption',
OVER_CONSUMPTION = 'average_consumption_greater_than_connector_capacity',
NEGATIVE_ACTIVITY = 'negative_inactivity',
LONG_INACTIVITY = 'long_inactivity',
NEGATIVE_DURATION = 'negative_duration',
+ LOW_DURATION = 'low_duration',
INVALID_START_DATE = 'incorrect_starting_date',
MISSING_PRICE = 'missing_price',
MISSING_USER = 'missing_user',

Added Low Inactivity + Low Consumption