From 6690c9c692d3b9eedd2c3461a9c574d7c5a09eb1 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 11 Jul 2024 09:15:18 -0700 Subject: [PATCH] IO-2841 Non-Parts listed in Jobline_Status Signed-off-by: Allan Carr --- .../job-detail-cards.parts.component.jsx | 12 +++++++++++- .../1720712957502_run_sql_migration/down.sql | 10 ++++++++++ .../1720712957502_run_sql_migration/up.sql | 8 ++++++++ .../1720713022389_run_sql_migration/down.sql | 10 ++++++++++ .../1720713022389_run_sql_migration/up.sql | 8 ++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 hasura/migrations/1720712957502_run_sql_migration/down.sql create mode 100644 hasura/migrations/1720712957502_run_sql_migration/up.sql create mode 100644 hasura/migrations/1720713022389_run_sql_migration/down.sql create mode 100644 hasura/migrations/1720713022389_run_sql_migration/up.sql diff --git a/client/src/components/job-detail-cards/job-detail-cards.parts.component.jsx b/client/src/components/job-detail-cards/job-detail-cards.parts.component.jsx index 92e875f99..a567918f5 100644 --- a/client/src/components/job-detail-cards/job-detail-cards.parts.component.jsx +++ b/client/src/components/job-detail-cards/job-detail-cards.parts.component.jsx @@ -26,6 +26,16 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) { const { t } = useTranslation(); const { joblines_status } = data; + const filteredJobLines = data.joblines.filter( + (j) => + j.part_type !== null && + j.part_type !== "PAE" && + j.part_type !== "PAS" && + j.part_type !== "PASL" && + j.part_qty !== 0 && + j.act_price !== 0 + ); +//TODO: Correct jobline_statuses view by including the part_qty !== 0 and act_price !== 0 const columns = [ { title: t("joblines.fields.line_desc"), @@ -95,7 +105,7 @@ export function JobDetailCardsPartsComponent({ loading, data, jobRO }) {
- +
); diff --git a/hasura/migrations/1720712957502_run_sql_migration/down.sql b/hasura/migrations/1720712957502_run_sql_migration/down.sql new file mode 100644 index 000000000..25f6a61a9 --- /dev/null +++ b/hasura/migrations/1720712957502_run_sql_migration/down.sql @@ -0,0 +1,10 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE OR REPLACE VIEW "public"."joblines_status" AS +-- SELECT j.jobid, +-- j.status, +-- count(1) AS count, +-- j.part_type +-- FROM joblines j +-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> 0) AND (j.act_price <> 0) AND (j.removed IS FALSE)) +-- GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1720712957502_run_sql_migration/up.sql b/hasura/migrations/1720712957502_run_sql_migration/up.sql new file mode 100644 index 000000000..8ffd417d5 --- /dev/null +++ b/hasura/migrations/1720712957502_run_sql_migration/up.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW "public"."joblines_status" AS + SELECT j.jobid, + j.status, + count(1) AS count, + j.part_type + FROM joblines j + WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> 0) AND (j.act_price <> 0) AND (j.removed IS FALSE)) + GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1720713022389_run_sql_migration/down.sql b/hasura/migrations/1720713022389_run_sql_migration/down.sql new file mode 100644 index 000000000..6e9bfe3ec --- /dev/null +++ b/hasura/migrations/1720713022389_run_sql_migration/down.sql @@ -0,0 +1,10 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE OR REPLACE VIEW "public"."joblines_status" AS +-- SELECT j.jobid, +-- j.status, +-- count(1) AS count, +-- j.part_type +-- FROM joblines j +-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> (0)::numeric) AND (j.act_price <> (0)::numeric) AND (j.removed IS FALSE)) +-- GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1720713022389_run_sql_migration/up.sql b/hasura/migrations/1720713022389_run_sql_migration/up.sql new file mode 100644 index 000000000..109db1e8e --- /dev/null +++ b/hasura/migrations/1720713022389_run_sql_migration/up.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW "public"."joblines_status" AS + SELECT j.jobid, + j.status, + count(1) AS count, + j.part_type + FROM joblines j + WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.part_qty <> (0)::numeric) AND (j.act_price <> (0)::numeric) AND (j.removed IS FALSE)) + GROUP BY j.jobid, j.status, j.part_type;