From aa0784500f60913b8a7bc4a274e71a57d89d9dbe Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Tue, 3 Dec 2024 17:48:50 +0100 Subject: [PATCH] [csv] fix csv exports with boolean values (force boolean values) --- src/store/modules/assets.js | 10 ++++++++-- src/store/modules/edits.js | 8 +++++++- src/store/modules/shots.js | 8 +++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/store/modules/assets.js b/src/store/modules/assets.js index a331ae35c..706b26bf9 100644 --- a/src/store/modules/assets.js +++ b/src/store/modules/assets.js @@ -726,11 +726,17 @@ const actions = { asset.description, asset.ready_for !== 'None' ? taskTypeMap.get(asset.ready_for).name : '' ]) + asset.data = asset.data || {} sortByName([...production.descriptors]) .filter(d => d.entity_type === 'Asset') .forEach(descriptor => { - asset.data = asset.data || {} - assetLine.push(asset.data[descriptor.field_name]) + if (descriptor.data_type === 'boolean') { + assetLine.push( + asset.data[descriptor.field_name]?.toLowerCase() === 'true' + ) + } else { + assetLine.push(asset.data[descriptor.field_name]) + } }) if (state.isAssetTime) { assetLine.push(minutesToDays(organisation, asset.timeSpent).toFixed(2)) diff --git a/src/store/modules/edits.js b/src/store/modules/edits.js index 47dbae151..36572ab75 100644 --- a/src/store/modules/edits.js +++ b/src/store/modules/edits.js @@ -539,7 +539,13 @@ const actions = { sortByName([...production.descriptors]) .filter(d => d.entity_type === 'Edit') .forEach(descriptor => { - editLine.push(edit.data[descriptor.field_name]) + if (descriptor.data_type === 'boolean') { + editLine.push( + edit.data[descriptor.field_name]?.toLowerCase() === 'true' + ) + } else { + editLine.push(edit.data[descriptor.field_name]) + } }) if (state.isEditTime) { editLine.push(minutesToDays(organisation, edit.timeSpent).toFixed(2)) diff --git a/src/store/modules/shots.js b/src/store/modules/shots.js index c7cfdd295..04808d028 100644 --- a/src/store/modules/shots.js +++ b/src/store/modules/shots.js @@ -654,7 +654,13 @@ const actions = { sortByName([...production.descriptors]) .filter(d => d.entity_type === 'Shot') .forEach(descriptor => { - shotLine.push(shot.data[descriptor.field_name]) + if (descriptor.data_type === 'boolean') { + shotLine.push( + shot.data[descriptor.field_name]?.toLowerCase() === 'true' + ) + } else { + shotLine.push(shot.data[descriptor.field_name]) + } }) if (state.isShotTime) { shotLine.push(minutesToDays(organisation, shot.timeSpent).toFixed(2))