From 46abf01366c6bc13985a31f3f3f47faefa2ae3e6 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 18 Nov 2021 09:19:34 -0800 Subject: [PATCH] IO-1533 Resolve defaults check issue for production board. --- .../production-board-kanban.component.jsx | 26 ++++++++++--------- .../down.sql | 1 + .../up.sql | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/down.sql create mode 100644 hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/up.sql diff --git a/client/src/components/production-board-kanban/production-board-kanban.component.jsx b/client/src/components/production-board-kanban/production-board-kanban.component.jsx index 53173e5bb..0ed42b338 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.component.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.component.jsx @@ -222,19 +222,21 @@ export function ProductionBoardKanbanComponent({ technician, card, bodyshop, - (associationSettings && + associationSettings && associationSettings.kanban_settings && - Object.keys(associationSettings.kanban_settings).length > 0) || { - ats: true, - clm_no: true, - compact: false, - ownr_nm: true, - sublets: true, - ins_co_nm: true, - production_note: true, - employeeassignments: true, - scheduled_completion: true, - } + Object.keys(associationSettings.kanban_settings).length > 0 + ? associationSettings.kanban_settings + : { + ats: true, + clm_no: true, + compact: false, + ownr_nm: true, + sublets: true, + ins_co_nm: true, + production_note: true, + employeeassignments: true, + scheduled_completion: true, + } ) } onCardDragEnd={handleDragEnd} diff --git a/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/down.sql b/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/down.sql new file mode 100644 index 000000000..117cc4a4e --- /dev/null +++ b/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/down.sql @@ -0,0 +1 @@ +alter table "public"."associations" alter column "kanban_settings" set default jsonb_build_object(); diff --git a/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/up.sql b/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/up.sql new file mode 100644 index 000000000..485ed2ac1 --- /dev/null +++ b/hasura/migrations/1637255828361_alter_table_public_associations_alter_column_kanban_settings/up.sql @@ -0,0 +1 @@ +alter table "public"."associations" alter column "kanban_settings" set default '{"ats": true, "clm_no": true, "compact": false, "ownr_nm": true, "sublets": true, "ins_co_nm": true, "production_note": true, "employeeassignments": true, "scheduled_completion": true}';