convert watts to kW
This commit is contained in:
parent
af1a649dc2
commit
5ca3496e14
@ -281,29 +281,49 @@ export default class {
|
||||
let prise_type_e = this.isTruthyValue(this.current_geojson_point.properties.prise_type_e)
|
||||
let prise_type_autre = this.isTruthyValue(this.current_geojson_point.properties.prise_type_autre)
|
||||
|
||||
if ((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)
|
||||
) > 0) {
|
||||
);
|
||||
if (countOfSockets > 0) {
|
||||
we_use_max_output = true;
|
||||
}
|
||||
// ajouter les tags de socket newProperties
|
||||
|
||||
let converted_value = originalValue.replace(/[^\d\.\,]/g, '').replace(',', '.')
|
||||
let max_output = 400
|
||||
let max_output = 401
|
||||
// do not limit accepted values
|
||||
// let accepted_values = [3, 7, 22, 50, 150, 300]
|
||||
// let accepted_values = [3, 7, 22, 50, 150, 300]
|
||||
// if (accepted_values.includes(converted_value)) {
|
||||
let out = ''
|
||||
if (originalValue < max_output) {
|
||||
|
||||
// enlever les lettres dans la valeur
|
||||
let out = converted_value + ' kW'
|
||||
if (we_use_max_output) {
|
||||
newProperties['socket:max:output'] = out;
|
||||
} else {
|
||||
out = converted_value + ' kW'
|
||||
|
||||
} else {
|
||||
// console.log('too high kW value detected', originalValue)
|
||||
// prise en charge des valeurs en Watts et non en kW.
|
||||
if(originalValue > 1000 && originalValue < 401000){
|
||||
|
||||
let kilowatts = ( parseFloat(converted_value ) /1000 ).toFixed(2).replace('.00','');
|
||||
out = ''+ kilowatts + ' kW'
|
||||
// console.log('valeurs en Watts out', out, 'original:', originalValue)
|
||||
}
|
||||
}
|
||||
|
||||
if (we_use_max_output) {
|
||||
newProperties['socket:max:output'] = out;
|
||||
} else {
|
||||
if (countOfSockets === 1) {
|
||||
|
||||
if (has_prise_type_2) {
|
||||
newProperties['socket:type_2:output'] = out;
|
||||
console.log('socket:type_2:output', out)
|
||||
}
|
||||
if (has_prise_type_combo_ccs) {
|
||||
newProperties['socket:type_2_combo:output'] = out;
|
||||
console.log('socket:type_2_combo:output', out)
|
||||
}
|
||||
if (prise_type_chademo) {
|
||||
newProperties['socket:chademo:output'] = out;
|
||||
@ -311,11 +331,12 @@ export default class {
|
||||
if (prise_type_e) {
|
||||
newProperties['socket:typee:output'] = out;
|
||||
}
|
||||
}else{
|
||||
console.log('sockets', countOfSockets)
|
||||
}
|
||||
return out
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
return out
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user