Browse Source

Check hierarchy before calculating s curve

pull/2/head
Wahyu Ramadhan 1 year ago
parent
commit
4064802ad9
  1. 8
      src/views/Dashboard/DashboardProject.js

8
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`;
}

Loading…
Cancel
Save