Renamed Session's ocpiWithCdr
MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -593,7 +593,7 @@ export default class TransactionService {
'id', 'chargeBoxID', 'timestamp', 'issuer', 'stateOfCharge', 'timezone', 'connectorId', 'meterStart', 'siteAreaID', 'siteID',
'currentTotalDurationSecs', 'currentTotalInactivitySecs', 'currentInstantWatts', 'currentTotalConsumptionWh', 'currentStateOfCharge',
'stop.price', 'stop.priceUnit', 'stop.inactivityStatus', 'stop.stateOfCharge', 'stop.timestamp', 'stop.totalConsumptionWh',
- 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'billingData.invoiceID', 'ocpiWithNoCdr', 'tagID', 'stop.tagID',
+ 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'billingData.invoiceID', 'ocpiWithCdr', 'tagID', 'stop.tagID',
]);
res.json(transactions);
next();
@@ -627,7 +627,7 @@ export default class TransactionService {
const transactions = await TransactionService.getTransactions(req, action, { completedTransactions: true }, [
'id', 'chargeBoxID', 'timestamp', 'issuer', 'stateOfCharge', 'timezone', 'connectorId', 'meterStart', 'siteAreaID', 'siteID',
'stop.price', 'stop.priceUnit', 'stop.inactivityStatus', 'stop.stateOfCharge', 'stop.timestamp', 'stop.totalConsumptionWh',
- 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'stop.meterStop', 'billingData.invoiceID', 'ocpiWithNoCdr', 'tagID', 'stop.tagID',
+ 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'stop.meterStop', 'billingData.invoiceID', 'ocpiWithCdr', 'tagID', 'stop.tagID',
]);
res.json(transactions);
next();
@@ -707,7 +707,7 @@ export default class TransactionService {
return TransactionService.getTransactions(req, ServerAction.TRANSACTIONS_EXPORT, { completedTransactions: true }, [
'id', 'chargeBoxID', 'timestamp', 'issuer', 'stateOfCharge', 'timezone', 'connectorId', 'meterStart', 'siteAreaID', 'siteID',
'stop.price', 'stop.priceUnit', 'stop.inactivityStatus', 'stop.stateOfCharge', 'stop.timestamp', 'stop.totalConsumptionWh',
- 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'billingData.invoiceID', 'ocpiWithNoCdr', 'tagID', 'stop.tagID',
+ 'stop.totalDurationSecs', 'stop.totalInactivitySecs', 'billingData.invoiceID', 'ocpiWithCdr', 'tagID', 'stop.tagID',
]);
}

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -553,11 +553,11 @@ export default class TransactionStorage {
$limit: dbParams.limit
});
// Add if OCPI CDR exists
- if (projectFields && projectFields.includes('ocpiWithNoCdr')) {
+ if (projectFields && projectFields.includes('ocpiWithCdr')) {
aggregation.push({
$addFields: {
- ocpiWithNoCdr: {
- $cond: { if: { $and: [{ $gt: ['$ocpiData', null] }, { $not: { $gt: ['$ocpiData.cdr', null] } }] }, then: true, else: false }
+ 'ocpiWithCdr': {
+ $cond: { if: { $and: [{ $gt: ['$ocpiData', null] }, { $gt: ['$ocpiData.cdr', null] }] }, then: true, else: false }
}
}
});

MODIFY
src/types/Transaction.ts
src/types/Transaction.ts
@@ -74,7 +74,7 @@ export default interface Transaction extends AbstractCurrentConsumption {
uniqueId?: string;
values?: Consumption[];
billingData?: BillingTransactionData;
- ocpiWithNoCdr?: boolean;
+ ocpiWithCdr?: boolean;
ocpiData?: OcpiData;
}

Renamed Session's ocpiWithCdr