From 4064802ad955b1a99f79fde6809cf5007143db30 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 22 Aug 2023 14:19:57 +0700 Subject: [PATCH] Check hierarchy before calculating s curve --- src/views/Dashboard/DashboardProject.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index d59f04d..45bca52 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -40,7 +40,7 @@ const DashboardProject = () => { } } const { PROJECT_ID, GANTT_ID, SCURVE } = useParams(); - const URL_GANTT = `https://adw-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`; + const URL_GANTT = `http://localhost/adw-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`; const mapRef = useRef() const [projectName, setProjectName] = useState(""); const [projectManagerName, setProjectManagerName] = useState(""); @@ -89,6 +89,7 @@ const DashboardProject = () => { const [dataGanttParents, setDataGanttParents] = useState({}); const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [calculationStatus, setCalculationStatus] = useState(false); + const [isHierarchy, setIsHierarchy] = useState(false); let history = useHistory(); @@ -151,6 +152,9 @@ const DashboardProject = () => { try { const response = await axios.get(url, HEADER) setDataGantt(response) + if (response.data.data.hierarchy_ftth_id) { + setIsHierarchy(true) + } setIsReadyGantt(true) } catch (error) { console.error('Failed to get gantt data:', error) @@ -251,7 +255,7 @@ const DashboardProject = () => { const getSCurve = async () => { setIsReadySCurve(false); let URL = `${BASE_OSPRO}/api/project/get-s-curve`; - if(SCURVE && SCURVE == "1"){ + if(SCURVE && SCURVE == "1" && isHierarchy){ URL = `${BASE_OSPRO}/api/project/calculate-s-curve`; }