mirror of
https://forge.chapril.org/tykayn/wololo
synced 2025-06-20 01:34:42 +02:00
boolean conversion returns now empty string when enumeration is present
This commit is contained in:
parent
e056ee504a
commit
6ac3a272ce
1 changed files with 18 additions and 2 deletions
|
@ -29,7 +29,8 @@ export default class MappingEngine {
|
|||
phones_updated: 0,
|
||||
power_output: 0,
|
||||
phones_updated_list: [],
|
||||
phones_not_updated: 0
|
||||
phones_not_updated: 0,
|
||||
enumeration_detected: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,8 +548,22 @@ export default class MappingEngine {
|
|||
|
||||
|
||||
private convertToYesOrNo(originalValue: any) {
|
||||
debugLog('convertProperty: ==========> original value', originalValue)
|
||||
let intermediateValue = '' + originalValue
|
||||
let isEnumeration = false;
|
||||
let convertedValue = '';
|
||||
|
||||
// handle lists with ; as separator
|
||||
if (intermediateValue.includes(';')) {
|
||||
isEnumeration = true;
|
||||
intermediateValue = intermediateValue.split(';')[0]
|
||||
}
|
||||
// on ne peut pas conclure ce que l'on doit garder avec une liste
|
||||
if (isEnumeration) {
|
||||
this.stats.enumeration_detected++
|
||||
return ''
|
||||
}
|
||||
|
||||
debugLog('convertProperty: ==========> original value', originalValue, intermediateValue)
|
||||
if (custom_utils.truthyValues.indexOf(originalValue) !== -1) {
|
||||
convertedValue = 'yes'
|
||||
} else {
|
||||
|
@ -559,6 +574,7 @@ export default class MappingEngine {
|
|||
} else {
|
||||
debugLog('convertProperty: ==========> !!! NOT in falsy values', originalValue)
|
||||
}
|
||||
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue