diff --git a/apps/web/src/common/modules/widgets/_widgets/gauge/Gauge.vue b/apps/web/src/common/modules/widgets/_widgets/gauge/Gauge.vue index 61eda4b7a8..aa801dd6df 100644 --- a/apps/web/src/common/modules/widgets/_widgets/gauge/Gauge.vue +++ b/apps/web/src/common/modules/widgets/_widgets/gauge/Gauge.vue @@ -178,10 +178,7 @@ const errorMessage = computed(() => { /* Util */ const drawChart = (rawData: WidgetLoadResponse|null) => { if (isEmpty(rawData)) return; - // HACK: Change the code below when the backend data is modified - // state.chartData = rawData?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] || 0; - const _targetData = state.data?.results?.find((d) => !!d[widgetOptionsState.dataFieldInfo?.data as string]); - state.chartData = _targetData?.[widgetOptionsState.dataFieldInfo?.data as string] || 0; + state.chartData = rawData?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] || 0; }; const loadWidget = () => { state.runQueries = true; diff --git a/apps/web/src/common/modules/widgets/_widgets/number-card/NumberCard.vue b/apps/web/src/common/modules/widgets/_widgets/number-card/NumberCard.vue index 58cbb9c295..ff62f5d214 100644 --- a/apps/web/src/common/modules/widgets/_widgets/number-card/NumberCard.vue +++ b/apps/web/src/common/modules/widgets/_widgets/number-card/NumberCard.vue @@ -64,18 +64,8 @@ const state = reactive({ data: computed(() => queryResults.value?.[0].data || null), previousData: computed(() => queryResults.value?.[1]?.data || null), unit: computed(() => widgetFrameProps.value.unitMap?.[widgetOptionsState.dataFieldInfo?.data as string]), - previousValue: computed(() => { - // HACK: Change the code below when the backend data is modified - // return state.previousData?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] ?? 0; - const _targetData = state.previousData?.results?.find((d) => !!d[widgetOptionsState.dataFieldInfo?.data as string]); - return _targetData?.[widgetOptionsState.dataFieldInfo?.data as string] || 0; - }), - currentValue: computed(() => { - // HACK: Change the code below when the backend data is modified - // return state.data?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] ?? 0; - const _targetData = state.data?.results?.find((d) => !!d[widgetOptionsState.dataFieldInfo?.data as string]); - return _targetData?.[widgetOptionsState.dataFieldInfo?.data as string] || 0; - }), + previousValue: computed(() => state.previousData?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] ?? 0), + currentValue: computed(() => state.data?.results?.[0]?.[widgetOptionsState.dataFieldInfo?.data as string] ?? 0), valueText: computed(() => getFormattedNumber(state.currentValue, widgetOptionsState.numberFormatInfo?.[widgetOptionsState.dataFieldInfo?.data as string], state.unit)), iconName: computed(() => widgetOptionsState.iconInfo?.icon?.name),