Skip to content

Commit 31c64f7

Browse files
committed
Refactoring code
1 parent 9146d3d commit 31c64f7

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

resources/js/processes-catalogue/components/ProcessCollapseInfo.vue

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ export default {
166166
},
167167
mounted() {
168168
this.verifyDescription();
169+
// Initialize chart data from process.counts
170+
this.inProgress = this.process.counts?.in_progress || 0;
171+
this.completed = this.process.counts?.completed || 0;
172+
this.total = this.process.counts?.total || 0;
169173
ProcessMaker.EventBus.$on("reloadByNewScreen", () => {
170174
window.location.reload();
171175
});
@@ -177,7 +181,6 @@ export default {
177181
}
178182
});
179183
this.getStartEvents();
180-
this.fetchChartData();
181184
},
182185
beforeDestroy() {
183186
ProcessMaker.EventBus.$off("chartDataUpdated");
@@ -242,24 +245,6 @@ export default {
242245
ProcessMaker.alert(err, "danger");
243246
});
244247
},
245-
/**
246-
* Fetch chart data for mini pie charts
247-
*/
248-
fetchChartData() {
249-
ProcessMaker.apiClient
250-
.get(`requests/${this.process.id}/default-chart`)
251-
.then((response) => {
252-
const { data: { datasets: { data: [completedCount, inProgressCount] } } } = response.data;
253-
this.completed = completedCount;
254-
this.inProgress = inProgressCount;
255-
this.total = this.completed + this.inProgress;
256-
})
257-
.catch(() => {
258-
this.inProgress = 0;
259-
this.completed = 0;
260-
this.total = 0;
261-
});
262-
},
263248
},
264249
};
265250
</script>

0 commit comments

Comments
 (0)