Fixed typos, added TODO tasks
MODIFY
src/client/oicp/CpoOICPClient.ts
src/client/oicp/CpoOICPClient.ts
@@ -63,17 +63,18 @@ export default class CpoOICPClient extends OICPClient {
addChargeBoxID: true
};
const oicpEvse = OICPMapping.getEvseByConnectorId(this.tenant, siteArea, chargingStation, transaction.connectorId, options);
- const oicpSession: OICPSession = {} as OICPSession;
- oicpSession.id = sessionId;
- oicpSession.start_datetime = transaction.timestamp;
- oicpSession.kwh = 0;
- oicpSession.identification = identification;
- oicpSession.evse = oicpEvse;
- oicpSession.currency = this.settings.currency;
- oicpSession.status = OICPSessionStatus.PENDING;
- oicpSession.total_cost = transaction.currentCumulatedPrice > 0 ? transaction.currentCumulatedPrice : 0;
- oicpSession.last_updated = transaction.timestamp;
- oicpSession.meterValueInBetween = [];
+ const oicpSession = {
+ id: sessionId,
+ start_datetime: transaction.timestamp,
+ kwh: 0,
+ identification: identification,
+ evse: oicpEvse,
+ currency: this.settings.currency,
+ status: OICPSessionStatus.PENDING,
+ total_cost: transaction.currentCumulatedPrice > 0 ? transaction.currentCumulatedPrice : 0,
+ last_updated: transaction.timestamp,
+ meterValueInBetween: [],
+ } as OICPSession;
transaction.oicpData = {
session: oicpSession
};
@@ -98,7 +99,7 @@ export default class CpoOICPClient extends OICPClient {
user: transaction.user
});
}
- transaction.oicpData.session.kwh = transaction.currentTotalConsumptionWh / 1000;
+ transaction.oicpData.session.kwh = Utils.createDecimal(transaction.currentTotalConsumptionWh).div(1000).toNumber();
transaction.oicpData.session.last_updated = transaction.currentTimestamp;
transaction.oicpData.session.total_cost = transaction.currentCumulatedPrice > 0 ? transaction.currentCumulatedPrice : 0;
transaction.oicpData.session.currency = this.settings.currency;
@@ -171,7 +172,7 @@ export default class CpoOICPClient extends OICPClient {
user: transaction.user
});
}
- transaction.oicpData.session.kwh = transaction.stop.totalConsumptionWh / 1000;
+ transaction.oicpData.session.kwh = Utils.createDecimal(transaction.stop.totalConsumptionWh).div(1000).toNumber();
transaction.oicpData.session.total_cost = transaction.stop.roundedPrice > 0 ? transaction.stop.roundedPrice : 0;
transaction.oicpData.session.end_datetime = transaction.stop.timestamp;
transaction.oicpData.session.last_updated = transaction.stop.timestamp;
@@ -232,9 +233,10 @@ export default class CpoOICPClient extends OICPClient {
// Get timestamp before starting process - to be saved in DB at the end of the process
const startDate = new Date();
// Get all charging stations from tenant
+ // TODO: Perfs/Memory issue in Prod: that does not scale with 100k charging stations, use pagination
const chargingStations = await OICPMapping.getAllChargingStations(this.tenant, 0, 0);
// Convert (public) charging stations to OICP EVSEs
- const evses = await OICPMapping.convertChargingStationsToEVSEs(this.tenant, chargingStations, options);
+ const evses = OICPMapping.convertChargingStationsToEVSEs(this.tenant, chargingStations, options);
let evsesToProcess: OICPEvseDataRecord[] = [];
let chargeBoxIDsToProcessFromInput = [];
// Check if all EVSEs should be processed - in case of delta send - process only following EVSEs:
@@ -322,7 +324,7 @@ export default class CpoOICPClient extends OICPClient {
};
}
// Save
- const executionDurationSecs = (new Date().getTime() - startTime) / 1000;
+ const executionDurationSecs = Utils.createDecimal(new Date().getTime()).minus(startTime).div(1000).toNumber();
await OICPEndpointStorage.saveOicpEndpoint(this.tenant.id, this.oicpEndpoint);
Logging.logOicpResult(this.tenant.id, ServerAction.OICP_PUSH_EVSE_DATA,
MODULE_NAME, 'sendEVSEs', result,
@@ -363,9 +365,10 @@ export default class CpoOICPClient extends OICPClient {
// Get timestamp before starting process - to be saved in DB at the end of the process
const startDate = new Date();
// Get all charging stations from tenant
+ // TODO: Perfs/Memory issue in Prod: that does not scale with 100k charging stations, use pagination
const chargingStations = await OICPMapping.getAllChargingStations(this.tenant, 0, 0);
// Convert (public) charging stations to OICP EVSE Statuses
- const evseStatuses = await OICPMapping.convertChargingStationsToEvseStatuses(this.tenant, chargingStations, options);
+ const evseStatuses = OICPMapping.convertChargingStationsToEvseStatuses(this.tenant, chargingStations, options);
let evseStatusesToProcess: OICPEvseStatusRecord[] = [];
let chargeBoxIDsToProcessFromInput = [];
// Check if all EVSE Statuses should be processed - in case of delta send - process only following EVSEs:
@@ -822,7 +825,10 @@ export default class CpoOICPClient extends OICPClient {
cdr.MeterValueStart = Utils.convertWattHourToKiloWattHour(transaction.meterStart, 3); // Optional
cdr.MeterValueEnd = Utils.convertWattHourToKiloWattHour(transaction.stop.meterStop, 3); // Optional
if (!Utils.isEmptyArray(transaction.oicpData.session.meterValueInBetween)) {
- cdr.MeterValueInBetween = { meterValues: transaction.oicpData.session.meterValueInBetween.map((wattHour) => Utils.convertWattHourToKiloWattHour(wattHour, 3)) }; // Optional
+ cdr.MeterValueInBetween = {
+ meterValues: transaction.oicpData.session.meterValueInBetween.map(
+ (wattHour) => Utils.convertWattHourToKiloWattHour(wattHour, 3))
+ }; // Optional
}
cdr.ConsumedEnergy = Utils.convertWattHourToKiloWattHour(transaction.stop.totalConsumptionWh, 3); // In kW.h
cdr.SignedMeteringValues; // Optional
@@ -992,7 +998,7 @@ export default class CpoOICPClient extends OICPClient {
payload.EvseID = transaction.oicpData.session.evse.EvseID;
payload.ChargingStart = transaction.timestamp;
payload.EventOccurred = transaction.currentTimestamp;
- payload.ChargingDuration = transaction.currentTimestamp.getTime() - transaction.timestamp.getTime(); // Optional Duration in milliseconds (Integer). Charging Duration = EventOccurred - Charging Duration. Same as transaction.currentTotalDurationSecs * 1000?
+ payload.ChargingDuration = Utils.createDecimal(transaction.currentTimestamp.getTime()).minus(transaction.timestamp.getTime()).toNumber(); // Optional Duration in milliseconds (Integer). Charging Duration = EventOccurred - Charging Duration. Same as transaction.currentTotalDurationSecs * 1000?
payload.SessionStart = transaction.oicpData.session.start_datetime; // Optional
payload.ConsumedEnergyProgress = Utils.convertWattHourToKiloWattHour(transaction.currentTotalConsumptionWh, 3); // In kW.h Optional
payload.MeterValueStart = Utils.convertWattHourToKiloWattHour(transaction.meterStart, 3); // Optional
@@ -1088,7 +1094,10 @@ export default class CpoOICPClient extends OICPClient {
payload.ConsumedEnergy = Utils.convertWattHourToKiloWattHour(transaction.stop.totalConsumptionWh, 3);
payload.MeterValueStart = Utils.convertWattHourToKiloWattHour(transaction.meterStart, 3); // Optional. kw or kWh?
payload.MeterValueEnd = Utils.convertWattHourToKiloWattHour(transaction.stop.meterStop, 3); // Optional. kW or kWh?
- payload.MeterValueInBetween = { meterValues: transaction.oicpData.session.meterValueInBetween.map((wattHour) => Utils.convertWattHourToKiloWattHour(wattHour, 3)) }; // Optional
+ payload.MeterValueInBetween = {
+ meterValues: transaction.oicpData.session.meterValueInBetween.map(
+ (wattHour) => Utils.convertWattHourToKiloWattHour(wattHour, 3))
+ }; // Optional
payload.OperatorID = this.getOperatorID(ServerAction.OICP_SEND_CHARGING_NOTIFICATION_END); // Optional
payload.PartnerProductID; // Optional
payload.PenaltyTimeStart = transaction.stop.timestamp; // Optional
@@ -1203,7 +1212,7 @@ export default class CpoOICPClient extends OICPClient {
/**
* Ping OICP Endpoint
*/
- public async ping() {
+ public async ping(): Promise<any> {
const pingResult: any = {};
// Try to access base Url (GET .../versions)
// Access versions API
@@ -1229,7 +1238,7 @@ export default class CpoOICPClient extends OICPClient {
/**
* POST to EVSE Endpoint without EVSEs
*/
- private async pingEvseEndpoint() {
+ private async pingEvseEndpoint(): Promise<any> {
await Logging.logInfo({
tenantID: this.tenant.id,
action: ServerAction.OICP_PUSH_EVSE_DATA,
@@ -1276,5 +1285,4 @@ export default class CpoOICPClient extends OICPClient {
}
return [];
}
-
}

MODIFY
src/client/oicp/OICPClient.ts
src/client/oicp/OICPClient.ts
@@ -35,7 +35,7 @@ export default abstract class OICPClient {
this.settings = settings;
this.oicpEndpoint = oicpEndpoint;
this.role = role.toLowerCase();
- this.axiosInstance = AxiosFactory.getAxiosInstance(tenant.id, { axiosConfig: this.getAxiosConfig(ServerAction.OICP_CREATE_AXIOS_INSTANCE) }); // FIXME: 'Converting circular structure to JSON' Error
+ this.axiosInstance = AxiosFactory.getAxiosInstance(tenant.id, { axiosConfig: this.getAxiosConfig() }); // FIXME: 'Converting circular structure to JSON' Error
}
public getLocalCountryCode(action: ServerAction): string {
@@ -168,7 +168,7 @@ export default abstract class OICPClient {
return await Cypher.decrypt(this.tenant.id, this.settings[this.role].cert);
}
- private getAxiosConfig(action: ServerAction): AxiosRequestConfig {
+ private getAxiosConfig(): AxiosRequestConfig {
const axiosConfig: AxiosRequestConfig = {} as AxiosRequestConfig;
// AxiosConfig.httpsAgent = await this.getHttpsAgent(action);
axiosConfig.headers = {

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -694,6 +694,7 @@ export default class OCPPService {
if (transaction.user || !transaction.user.issuer) {
// Assumption: Either Gireve or Hubject is enabled for eRoaming
// OCPI or OICP
+ // TODO: OCPI and OICP must work together and then the IOP must be identified clearly to call the right implementation
if (Utils.isTenantComponentActive(tenant, TenantComponents.OCPI)) {
// OCPI
await OCPPUtils.processOCPITransaction(headers.tenantID, transaction, chargingStation, TransactionAction.START);

MODIFY
src/server/oicp/OICPUtils.ts
src/server/oicp/OICPUtils.ts
@@ -74,6 +74,7 @@ export default class OICPUtils {
public static async getChargingStationConnectorFromEvseID(tenant: Tenant, evseID: OICPEvseID): Promise<{ chargingStation: ChargingStation, connector: Connector }> {
// It is not save to derive charging station id from evseID
const evseIDComponents = RoamingUtils.getEvseIdComponents(evseID);
+ // TODO: Perfs/Memory issue in Prod: that does not scale with 100k charging stations, use oicpData in charging station to find it
const chargingStations = await ChargingStationStorage.getChargingStations(tenant.id, {
issuer: true
}, Constants.DB_PARAMS_MAX_LIMIT);

MODIFY
src/server/oicp/oicp-services-impl/oicp-2.3.0/OICPMapping.ts
src/server/oicp/oicp-services-impl/oicp-2.3.0/OICPMapping.ts
@@ -57,6 +57,7 @@ export default class OICPMapping {
* Get All Charging Stations from given Tenant
* @param {Tenant} tenant
*/
+ // TODO: Perfs/Memory issue in Prod: that does not scale with 100k charging stations, remove this method
public static async getAllChargingStations(tenant: Tenant, limit: number, skip: number): Promise<ChargingStation[]> {
// Result
const chargingStations: ChargingStation[] = [];
@@ -70,7 +71,7 @@ export default class OICPMapping {
return chargingStations;
}
- public static async convertChargingStationsToEVSEs(tenant: Tenant, chargingStations: ChargingStation[], options: { countryID: string; partyID: string; addChargeBoxID?: boolean }): Promise<OICPEvseDataRecord[]> {
+ public static convertChargingStationsToEVSEs(tenant: Tenant, chargingStations: ChargingStation[], options: { countryID: string; partyID: string; addChargeBoxID?: boolean }): OICPEvseDataRecord[] {
const evses: OICPEvseDataRecord[] = [];
// Convert charging stations to evse(s)
for (const chargingStation of chargingStations) {
@@ -82,7 +83,7 @@ export default class OICPMapping {
return evses;
}
- public static async convertChargingStationsToEvseStatuses(tenant: Tenant, chargingStations: ChargingStation[], options: { countryID: string; partyID: string; addChargeBoxID?: boolean }): Promise<OICPEvseStatusRecord[]> {
+ public static convertChargingStationsToEvseStatuses(tenant: Tenant, chargingStations: ChargingStation[], options: { countryID: string; partyID: string; addChargeBoxID?: boolean }): OICPEvseStatusRecord[] {
const evseStatuses: OICPEvseStatusRecord[] = [];
// Convert charging stations to evse status(es)
for (const chargingStation of chargingStations) {
@@ -123,11 +124,11 @@ export default class OICPMapping {
* @param options
* @return Array of charging stations
*/
+ // TODO: Perfs/Memory issue in Prod: that does not scale with 100k charging stations, remove this method
private static async getAllChargingStationsFromSiteArea(tenant: Tenant, siteArea: SiteArea): Promise<ChargingStation[]> {
// Get Charging Stations
- // TODO: Add parameter to select only public charging stations
const chargingStations = await ChargingStationStorage.getChargingStations(tenant.id,
- { siteAreaIDs: [siteArea.id], includeDeleted: false }, Constants.DB_PARAMS_MAX_LIMIT);
+ { siteAreaIDs: [siteArea.id], includeDeleted: false, public: true }, Constants.DB_PARAMS_MAX_LIMIT);
// Return charging Stations
return chargingStations.result;
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -90,17 +90,16 @@ export default class ChargingStationService {
}
if (Utils.objectHasProperty(filteredRequest, 'public')) {
if (filteredRequest.public !== chargingStation.public) {
- if (filteredRequest.public === false) {
+ if (!filteredRequest.public) {
// Remove charging station from ocpi
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OCPI)) {
- const tenant = await TenantStorage.getTenant(req.user.tenantID);
try {
- const ocpiClient: CpoOCPIClient = await OCPIClientFactory.getAvailableOcpiClient(tenant, OCPIRole.CPO) as CpoOCPIClient;
+ const ocpiClient: CpoOCPIClient = await OCPIClientFactory.getAvailableOcpiClient(req.tenant, OCPIRole.CPO) as CpoOCPIClient;
if (ocpiClient) {
await ocpiClient.removeChargingStation(chargingStation);
}
} catch (error) {
- Logging.logError({
+ await Logging.logError({
tenantID: req.user.tenantID,
module: MODULE_NAME, method: 'handleUpdateChargingStationParams',
action: action,
@@ -116,9 +115,8 @@ export default class ChargingStationService {
if (filteredRequest.public === false) {
actionType = OICPActionType.DELETE;
}
- const tenant = await TenantStorage.getTenant(req.user.tenantID);
try {
- const oicpClient: CpoOICPClient = await OICPClientFactory.getAvailableOicpClient(tenant, OCPIRole.CPO) as CpoOICPClient;
+ const oicpClient: CpoOICPClient = await OICPClientFactory.getAvailableOicpClient(req.tenant, OCPIRole.CPO) as CpoOICPClient;
if (oicpClient) {
// Define get option
const options = {
@@ -126,10 +124,10 @@ export default class ChargingStationService {
countryID: oicpClient.getLocalCountryCode(ServerAction.OICP_PUSH_EVSE_DATA),
partyID: oicpClient.getLocalPartyID(ServerAction.OICP_PUSH_EVSE_DATA)
};
- await oicpClient.pushEvseData(OICPMapping.convertChargingStation2MultipleEvses(tenant, chargingStation.siteArea, chargingStation, options), actionType);
+ await oicpClient.pushEvseData(OICPMapping.convertChargingStation2MultipleEvses(req.tenant, chargingStation.siteArea, chargingStation, options), actionType);
}
} catch (error) {
- Logging.logError({
+ await Logging.logError({
tenantID: req.user.tenantID,
module: MODULE_NAME, method: 'handleUpdateChargingStationParams',
action: action,
@@ -214,7 +212,7 @@ export default class ChargingStationService {
// Update
await ChargingStationStorage.saveChargingStation(req.user.tenantID, chargingStation);
// Log
- Logging.logSecurityInfo({
+ await Logging.logSecurityInfo({
tenantID: req.user.tenantID,
source: chargingStation.id, action: action,
user: req.user, module: MODULE_NAME,
@@ -337,7 +335,7 @@ export default class ChargingStationService {
});
}
// Log
- Logging.logWarning({
+ await Logging.logWarning({
tenantID: req.user.tenantID,
source: chargingStation.id,
action: action,
@@ -365,7 +363,7 @@ export default class ChargingStationService {
user: req.user
});
}
- Logging.logInfo({
+ await Logging.logInfo({
tenantID: req.user.tenantID,
source: chargingStation.id,
action: action,
@@ -764,9 +762,8 @@ export default class ChargingStationService {
// Remove charging station from HBS
if (chargingStation.public) {
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OICP)) {
- const tenant = await TenantStorage.getTenant(req.user.tenantID);
try {
- const oicpClient: CpoOICPClient = await OICPClientFactory.getAvailableOicpClient(tenant, OCPIRole.CPO) as CpoOICPClient;
+ const oicpClient: CpoOICPClient = await OICPClientFactory.getAvailableOicpClient(req.tenant, OCPIRole.CPO) as CpoOICPClient;
if (oicpClient) {
// Define get option
const options = {
@@ -774,10 +771,10 @@ export default class ChargingStationService {
countryID: oicpClient.getLocalCountryCode(ServerAction.OICP_PUSH_EVSE_DATA),
partyID: oicpClient.getLocalPartyID(ServerAction.OICP_PUSH_EVSE_DATA)
};
- await oicpClient.pushEvseData(OICPMapping.convertChargingStation2MultipleEvses(tenant, chargingStation.siteArea, chargingStation, options), OICPActionType.DELETE);
+ await oicpClient.pushEvseData(OICPMapping.convertChargingStation2MultipleEvses(req.tenant, chargingStation.siteArea, chargingStation, options), OICPActionType.DELETE);
}
} catch (error) {
- Logging.logError({
+ await Logging.logError({
tenantID: req.user.tenantID,
module: MODULE_NAME, method: 'handleDeleteChargingStation',
action: action,
@@ -806,7 +803,7 @@ export default class ChargingStationService {
await ChargingStationStorage.deleteChargingStation(req.user.tenantID, chargingStation.id);
}
// Log
- Logging.logSecurityInfo({
+ await Logging.logSecurityInfo({
tenantID: req.user.tenantID,
user: req.user, module: MODULE_NAME, method: 'handleDeleteChargingStation',
message: `Charging Station '${chargingStation.id}' has been deleted successfully`,
@@ -1053,7 +1050,7 @@ export default class ChargingStationService {
});
// Handle Errors
bucketStream.on('error', (error) => {
- Logging.logError({
+ void Logging.logError({
tenantID: Constants.DEFAULT_TENANT,
action: action,
message: `Firmware '${filteredRequest.FileName}' has not been found!`,
@@ -1068,7 +1065,7 @@ export default class ChargingStationService {
// End of download
await new Promise((resolve) => {
bucketStream.on('end', () => {
- Logging.logInfo({
+ void Logging.logInfo({
tenantID: Constants.DEFAULT_TENANT,
action: action,
message: `Firmware '${filteredRequest.FileName}' has been downloaded with success`,
@@ -1585,7 +1582,7 @@ export default class ChargingStationService {
result.status === OCPPConfigurationStatus.REBOOT_REQUIRED) {
// Reboot?
if (result.status === OCPPConfigurationStatus.REBOOT_REQUIRED) {
- Logging.logWarning({
+ await Logging.logWarning({
tenantID: tenantID,
source: chargingStation.id,
user: user,
@@ -1684,7 +1681,7 @@ export default class ChargingStationService {
if (result) {
// OCPP Command with status
if (Utils.objectHasProperty(result, 'status') && ![OCPPStatus.ACCEPTED, OCPPUnlockStatus.UNLOCKED].includes(result.status)) {
- Logging.logError({
+ await Logging.logError({
tenantID: tenantID,
source: chargingStation.id,
user: user,
@@ -1695,7 +1692,7 @@ export default class ChargingStationService {
});
} else {
// OCPP Command with no status
- Logging.logInfo({
+ await Logging.logInfo({
tenantID: tenantID,
source: chargingStation.id,
user: user,

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -155,7 +155,7 @@ export default class ChargingStationStorage {
search?: string; chargingStationIDs?: string[]; chargingStationSerialNumbers?: string[]; siteAreaIDs?: string[]; withNoSiteArea?: boolean;
connectorStatuses?: string[]; connectorTypes?: string[]; statusChangedBefore?: Date;
siteIDs?: string[]; withSite?: boolean; includeDeleted?: boolean; offlineSince?: Date; issuer?: boolean;
- locCoordinates?: number[]; locMaxDistanceMeters?: number;
+ locCoordinates?: number[]; locMaxDistanceMeters?: number; public?: boolean;
},
dbParams: DbParams, projectFields?: string[]): Promise<DataResult<ChargingStation>> {
// Debug
@@ -198,6 +198,10 @@ export default class ChargingStationStorage {
if (!params.includeDeleted) {
filters.deleted = { '$ne': true };
}
+ // Public Charging Stations
+ if (Utils.objectHasProperty(params, 'public')) {
+ filters.public = params.public;
+ }
// Charging Stations
if (!Utils.isEmptyArray(params.chargingStationIDs)) {
filters._id = {

MODIFY
src/utils/AxiosFactory.ts
src/utils/AxiosFactory.ts
@@ -5,8 +5,6 @@ import Configuration from './Configuration';
import Logging from './Logging';
import { StatusCodes } from 'http-status-codes';
-const MODULE_NAME = 'AxiosFactory';
-
export default class AxiosFactory {
private static axiosInstances: Map<string, AxiosInstance> = new Map<string, AxiosInstance>();
@@ -30,29 +28,20 @@ export default class AxiosFactory {
if (!axiosInstance) {
// Create
axiosInstance = axios.create(instanceConfiguration.axiosConfig);
-
- // FIXME
- // Error Message: Converting circular structure to JSON
- // Temporary FIX: Utils.cloneObject() removed
-
// Add a Request interceptor
axiosInstance.interceptors.request.use((request: AxiosRequestConfig) => {
- Logging.logAxiosRequest(tenantID, request);
+ void Logging.logAxiosRequest(tenantID, request);
return request;
}, async (error: AxiosError) => {
- Logging.logAxiosError(tenantID, error);
+ void Logging.logAxiosError(tenantID, error);
return Promise.reject(error);
});
-
- // FIXME
- // Error Message: Converting circular structure to JSON
-
// Add a Response interceptor
axiosInstance.interceptors.response.use((response: AxiosResponse) => {
- Logging.logAxiosResponse(tenantID, response);
+ void Logging.logAxiosResponse(tenantID, response);
return response;
}, async (error: AxiosError) => {
- Logging.logAxiosError(tenantID, error);
+ void Logging.logAxiosError(tenantID, error);
return Promise.reject(error);
});
// Add

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -514,9 +514,9 @@ export default class Utils {
public static convertWattHourToKiloWattHour(wattHours: number, decimalPlaces?: number): number {
if (decimalPlaces) {
- return Utils.truncTo((wattHours / 1000), decimalPlaces);
+ return Utils.truncTo((Utils.createDecimal(wattHours).div(1000)).toNumber(), decimalPlaces);
}
- return Utils.convertToFloat((wattHours / 1000));
+ return Utils.convertToFloat((Utils.createDecimal(wattHours).div(1000)));
}
public static createDecimal(value: number): Decimal {
@@ -1250,7 +1250,6 @@ export default class Utils {
}
}
break;
-
// Billing
case TenantComponents.BILLING:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1261,7 +1260,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// Refund
case TenantComponents.REFUND:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1272,7 +1270,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// OCPI
case TenantComponents.OCPI:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1283,7 +1280,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// OICP
case TenantComponents.OICP:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1294,7 +1290,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// SAC
case TenantComponents.ANALYTICS:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1305,7 +1300,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// Smart Charging
case TenantComponents.SMART_CHARGING:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
@@ -1316,7 +1310,6 @@ export default class Utils {
} as SettingDBContent;
}
break;
-
// Asset
case TenantComponents.ASSET:
if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {

Fixed typos, added TODO tasks