clean kw and choose socket output max
This commit is contained in:
parent
5ca3496e14
commit
1431cd7af6
@ -274,16 +274,17 @@ export default class {
|
|||||||
// trouver à quel socket ça correspond
|
// trouver à quel socket ça correspond
|
||||||
// si y'a plusieurs sockets, utiliser socket:max:output
|
// si y'a plusieurs sockets, utiliser socket:max:output
|
||||||
let we_use_max_output = false;
|
let we_use_max_output = false;
|
||||||
let has_prise_type_2 = this.isTruthyValue(this.current_geojson_point.properties.prise_type_2)
|
let has_prise_type_2: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_2) || false
|
||||||
let has_prise_type_combo_ccs = this.isTruthyValue(this.current_geojson_point.properties.prise_type_combo_ccs)
|
let has_prise_type_combo_ccs: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_combo_ccs) || false
|
||||||
let prise_type_chademo = this.isTruthyValue(this.current_geojson_point.properties.prise_type_chademo)
|
let prise_type_chademo: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_chademo) || false
|
||||||
let prise_type_ef = this.isTruthyValue(this.current_geojson_point.properties.prise_type_ef)
|
let prise_type_ef: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_ef) || false
|
||||||
let prise_type_e = this.isTruthyValue(this.current_geojson_point.properties.prise_type_e)
|
let prise_type_e: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_e) || false
|
||||||
let prise_type_autre = this.isTruthyValue(this.current_geojson_point.properties.prise_type_autre)
|
let prise_type_autre: boolean = this.isTruthyValue(this.current_geojson_point.properties.prise_type_autre) || false
|
||||||
|
|
||||||
let countOfSockets = (boolToAddable(has_prise_type_2) + boolToAddable(has_prise_type_combo_ccs) + boolToAddable(prise_type_chademo) +
|
let countOfSockets = (boolToAddable(has_prise_type_2) + boolToAddable(has_prise_type_combo_ccs) + boolToAddable(prise_type_chademo) +
|
||||||
boolToAddable(prise_type_ef) + boolToAddable(prise_type_autre) + boolToAddable(prise_type_e)
|
boolToAddable(prise_type_ef) + boolToAddable(prise_type_autre) + boolToAddable(prise_type_e)
|
||||||
);
|
);
|
||||||
|
// console.log('this.current_geojson_point.properties.prise_type_2', this.current_geojson_point.properties.prise_type_2, this.isTruthyValue(this.current_geojson_point.properties.prise_type_2), 'countOfSockets:', countOfSockets)
|
||||||
if (countOfSockets > 0) {
|
if (countOfSockets > 0) {
|
||||||
we_use_max_output = true;
|
we_use_max_output = true;
|
||||||
}
|
}
|
||||||
@ -303,14 +304,21 @@ export default class {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// console.log('too high kW value detected', originalValue)
|
// console.log('too high kW value detected', originalValue)
|
||||||
// prise en charge des valeurs en Watts et non en kW.
|
// prise en charge des valeurs en Watts et non en kW.
|
||||||
if(originalValue > 1000 && originalValue < 401000){
|
if (originalValue > 1000 && originalValue < 401000) {
|
||||||
|
|
||||||
let kilowatts = ( parseFloat(converted_value ) /1000 ).toFixed(2).replace('.00','');
|
let kilowatts = (parseFloat(converted_value) / 1000).toFixed(2).replace('.00', '');
|
||||||
out = ''+ kilowatts + ' kW'
|
out = ('' + kilowatts + ' kW').replace('.00', '')
|
||||||
// console.log('valeurs en Watts out', out, 'original:', originalValue)
|
// console.log('valeurs en Watts out', out, 'original:', originalValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out = (out).replace('.00', '')
|
||||||
|
|
||||||
|
// debug land
|
||||||
|
if (has_prise_type_combo_ccs) {
|
||||||
|
newProperties['socket:type_2_combo:output'] = out;
|
||||||
|
console.log('socket:type_2_combo:output', out, originalValue)
|
||||||
|
}
|
||||||
|
|
||||||
if (we_use_max_output) {
|
if (we_use_max_output) {
|
||||||
newProperties['socket:max:output'] = out;
|
newProperties['socket:max:output'] = out;
|
||||||
@ -319,11 +327,11 @@ export default class {
|
|||||||
|
|
||||||
if (has_prise_type_2) {
|
if (has_prise_type_2) {
|
||||||
newProperties['socket:type_2:output'] = out;
|
newProperties['socket:type_2:output'] = out;
|
||||||
console.log('socket:type_2:output', out)
|
// console.log('socket:type_2:output', out)
|
||||||
}
|
}
|
||||||
if (has_prise_type_combo_ccs) {
|
if (has_prise_type_combo_ccs) {
|
||||||
newProperties['socket:type_2_combo:output'] = out;
|
newProperties['socket:type_2_combo:output'] = out;
|
||||||
console.log('socket:type_2_combo:output', out)
|
// console.log('socket:type_2_combo:output', out)
|
||||||
}
|
}
|
||||||
if (prise_type_chademo) {
|
if (prise_type_chademo) {
|
||||||
newProperties['socket:chademo:output'] = out;
|
newProperties['socket:chademo:output'] = out;
|
||||||
@ -331,8 +339,12 @@ export default class {
|
|||||||
if (prise_type_e) {
|
if (prise_type_e) {
|
||||||
newProperties['socket:typee:output'] = out;
|
newProperties['socket:typee:output'] = out;
|
||||||
}
|
}
|
||||||
}else{
|
} else if (has_prise_type_2 && prise_type_e) {
|
||||||
console.log('sockets', countOfSockets)
|
newProperties['socket:type_2:output'] = out;
|
||||||
|
console.log('2 prises, attribuer la plus haute valeur à la type 2', out)
|
||||||
|
} else {
|
||||||
|
console.log('no sockets', this.current_geojson_point.properties.ref)
|
||||||
|
// console.log('sockets', countOfSockets, this.current_geojson_point.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
@ -502,7 +514,14 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private isTruthyValue(someValue: string) {
|
private isTruthyValue(someValue: string) {
|
||||||
return this.truthyValues.includes(someValue)
|
let convertedValue;
|
||||||
|
if (this.truthyValues.indexOf(someValue) !== -1) {
|
||||||
|
convertedValue = true
|
||||||
|
}
|
||||||
|
if (this.falsyValues.indexOf(someValue) !== -1) {
|
||||||
|
convertedValue = false
|
||||||
|
}
|
||||||
|
return convertedValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private convertToBooleanValue(originalValue: any) {
|
private convertToBooleanValue(originalValue: any) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user