[offers][fix] add checks for data.income

pull/501/head
Stuart Long Chay Boon 3 years ago
parent f05444fdec
commit 50176e82a2

@ -168,12 +168,20 @@ const seedSalaries = async () => {
create: { create: {
baseCurrency: baseCurrencyString, baseCurrency: baseCurrencyString,
baseValue: await convert( baseValue: await convert(
data.Income, data.Income
? typeof data.Income === 'number'
? data.Income
: 0
: 0,
'SGD', // assume sgd 'SGD', // assume sgd
baseCurrencyString, baseCurrencyString,
), ),
currency: 'SGD', // assume sgd currency: 'SGD', // assume sgd
value: data.Income, value: data.Income
? typeof data.Income === 'number'
? data.Income
: 0
: 0,
}, },
}, },
startYear: xlSerialToJsDate( startYear: xlSerialToJsDate(
@ -219,12 +227,20 @@ const seedSalaries = async () => {
create: { create: {
baseCurrency: baseCurrencyString, baseCurrency: baseCurrencyString,
baseValue: await convert( baseValue: await convert(
data.Income, data.Income
? typeof data.Income === 'number'
? data.Income
: 0
: 0,
'SGD', // assume sgd 'SGD', // assume sgd
baseCurrencyString, baseCurrencyString,
), ),
currency: 'SGD', // assume sgd currency: 'SGD', // assume sgd
value: data.Income, value: data.Income
? typeof data.Income === 'number'
? data.Income
: 0
: 0,
}, },
}, },
bonus: { bonus: {
@ -302,7 +318,7 @@ const seedSalaries = async () => {
console.log('Invalid Company: ' + data.Company); console.log('Invalid Company: ' + data.Company);
} }
} else { } else {
console.log('Invalid Income not a number: ' + data.Income); console.log('Invalid TC not a number: ' + data.TC);
} }
}), }),
); );

Binary file not shown.
Loading…
Cancel
Save