Deactivate tasks for first deployement in prod (2 phases deployment)
MODIFY
src/migration/MigrationHandler.ts
src/migration/MigrationHandler.ts
@@ -68,11 +68,11 @@ export default class MigrationHandler {
currentMigrationTasks.push(new AddActivePropertyToTagsTask());
currentMigrationTasks.push(new InitialCarImportTask());
currentMigrationTasks.push(new UpdateConsumptionsToObjectIDs());
- currentMigrationTasks.push(new AddSiteAreaLimitToConsumptionsTask());
currentMigrationTasks.push(new MigrateOcpiTransactionsTask());
- currentMigrationTasks.push(new UpdateChargingStationStaticLimitationTask());
currentMigrationTasks.push(new UpdateChargingStationTemplatesTask());
- // CurrentMigrationTasks.push(new UpdateLimitsInConsumptionsTask());
+ currentMigrationTasks.push(new UpdateChargingStationStaticLimitationTask());
+ // CurrentMigrationTasks.push(new AddSiteAreaLimitToConsumptionsTask());
+ // currentMigrationTasks.push(new UpdateLimitsInConsumptionsTask());
// Get the already done migrations from the DB
const migrationTasksDone = await MigrationStorage.getMigrations();
// Check

MODIFY
src/migration/tasks/AddSiteAreaLimitToConsumptionsTask.ts
src/migration/tasks/AddSiteAreaLimitToConsumptionsTask.ts
@@ -29,7 +29,6 @@ export default class AddSiteAreaLimitToConsumptionsTask extends MigrationTask {
const result = await global.database.getCollection(tenant.id, 'consumptions').updateMany(
{
siteAreaID: Utils.convertToObjectID(siteArea.id),
- limitSiteAreaSource: { $exists: false },
},
{
$set: {
@@ -44,14 +43,24 @@ export default class AddSiteAreaLimitToConsumptionsTask extends MigrationTask {
let limitSiteAreaWatts = 0;
for (const chargingStation of siteArea.chargingStations) {
for (const connector of chargingStation.connectors) {
- limitSiteAreaWatts += connector.power;
+ let limitAmps = 0;
+ // Amps from chargepoint?
+ if (chargingStation.chargePoints) {
+ const chargePoint = Utils.getChargePointFromID(chargingStation, connector.chargePointID);
+ limitAmps = Utils.getChargingStationAmperage(chargingStation, chargePoint, connector.connectorId);
+ // Amps from connector
+ } else if (connector.amperage) {
+ limitAmps = connector.amperage;
+ }
+ if (limitAmps) {
+ limitSiteAreaWatts += Utils.convertAmpToWatt(chargingStation, connector.connectorId, limitAmps);
+ }
}
}
// Update
const result = await global.database.getCollection(tenant.id, 'consumptions').updateMany(
{
siteAreaID: Utils.convertToObjectID(siteArea.id),
- limitSiteAreaSource: { $exists: false },
},
{
$set: {
@@ -76,7 +85,7 @@ export default class AddSiteAreaLimitToConsumptionsTask extends MigrationTask {
}
getVersion() {
- return '1.0';
+ return '1.1';
}
getName() {

MODIFY
src/migration/tasks/UpdateLimitsInConsumptionsTask.ts
src/migration/tasks/UpdateLimitsInConsumptionsTask.ts
@@ -32,7 +32,7 @@ export default class UpdateLimitsInConsumptionsTask extends MigrationTask {
let limitWatts = 0, limitAmps = 0;
// Amps from chargepoint?
if (chargingStation.chargePoints) {
- const chargePoint = Utils.getChargePointFromID(chargingStation, connector.connectorId);
+ const chargePoint = Utils.getChargePointFromID(chargingStation, connector.chargePointID);
limitAmps = Utils.getChargingStationAmperage(chargingStation, chargePoint, connector.connectorId);
// Amps from connector
} else if (connector.amperage) {

Deactivate tasks for first deployement in prod (2 phases deployment)