From 3af12f12004cf988b57d492b5b2ff00385d4d8c2 Mon Sep 17 00:00:00 2001 From: PowerMaxZ Date: Mon, 30 Oct 2023 14:03:31 +0000 Subject: [PATCH] added average by case for transitions bar chart --- .../overview/AllTransitionsLayout.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/dashboard/overview/AllTransitionsLayout.tsx b/src/components/dashboard/overview/AllTransitionsLayout.tsx index 8f5faa9..f4428c7 100644 --- a/src/components/dashboard/overview/AllTransitionsLayout.tsx +++ b/src/components/dashboard/overview/AllTransitionsLayout.tsx @@ -34,10 +34,20 @@ const AllTransitionsLayout: React.FC = ({jobId}) => { const [showTable2, setShowTable2] = useState(false); const [displayMode, setDisplayMode] = useState("average"); const [pieChartDisplayMode, setPieChartDisplayMode] = useState("average"); - const [dataMode, setDataMode] = useState("Average"); - const transitionsDataAverage = useFetchData(`/activity_transitions_average/${jobId}`); + const [dataMode, setDataMode] = useState("AverageC"); + const transitionsDataAvgTransition = useFetchData(`/activity_transitions_average/${jobId}`); const transitionsDataTotal = useFetchData(`/activity_transitions/${jobId}`); - const transitionsData = dataMode === "Average" ? transitionsDataAverage : transitionsDataTotal; + const transitionsDataAvgCase = useFetchData(`/activity_transitions_average_case/${jobId}`); + let transitionsData; + + if (dataMode === "AverageC") { + transitionsData = transitionsDataAvgCase; + } else if (dataMode === "AverageT") { + transitionsData = transitionsDataAvgTransition; + } else { + transitionsData = transitionsDataTotal; + } + if (!overviewData || !transitionsData || !cteTableData || !potentialCteData || !timeframeData) { return
Loading...
; @@ -327,7 +337,8 @@ const AllTransitionsLayout: React.FC = ({jobId}) => { onChange={(e) => setDataMode(e.target.value)} label="Data Mode" > - Average by transition + Average by case + Average by transition Total