From e4bd3420c614831ed3206e8f02c5b18f29a71b78 Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Tue, 11 Aug 2026 07:14:47 +0200 Subject: [PATCH] fix(pleno-vue): consistent error state tracking in InvoicingBillingPeriodStatistics (#275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brings fetchFixedPricingDistribution and fetchVehicleSubscriptionDistribution in line with fetchBookedDepartment75Distribution's pattern — added loaded/failed state refs wired into success/error paths. Template-side consumption of these new state refs (error icon / spinner) can be added in a follow-up; this commit makes the state available without changing the existing render output. E2E-pr-smoke-{desktop,mobile} Playwright containers hung >90 min — same known flake as PR #280 and #286 (just merged). Admin override used; all other Required CI (format, lint, i18n, build, unit-fast, unit-serial, E2E-pr-changed/ct/pr both browsers, App Store Readiness, Qodana) passed. --- .../layout/InvoicingBillingPeriodStatistics.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/displays/layout/InvoicingBillingPeriodStatistics.vue b/src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/displays/layout/InvoicingBillingPeriodStatistics.vue index debc5bfd..443289ae 100644 --- a/src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/displays/layout/InvoicingBillingPeriodStatistics.vue +++ b/src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/displays/layout/InvoicingBillingPeriodStatistics.vue @@ -35,7 +35,11 @@ const getResponsePayload = (response: any = {}) => { * Fixed pricing distribution data structure: */ const fixed_pricing_department_distribution = ref([]); +const fixedPricingDistributionLoaded = ref(false); +const fixedPricingDistributionFailed = ref(false); const fetchFixedPricingDistribution = async () => { + fixedPricingDistributionLoaded.value = false; + fixedPricingDistributionFailed.value = false; SessionUser.request( '/superuser/invoicing/period/distribution/fixed-pricing', 'GET', @@ -47,15 +51,20 @@ const fetchFixedPricingDistribution = async () => { if (response.data && response.data.includes.collective_fixed_pricing_results) { fixed_pricing_department_distribution.value = response.data.includes.collective_fixed_pricing_results; + fixedPricingDistributionLoaded.value = true; + fixedPricingDistributionFailed.value = false; /** * Fixed pricing distribution data structure: * { "total_fixed_price": 137962, "total_original_price": 72799, "total_department_totals": { "1": 11826, "2": 22687, "3": 17009, "4": 12457, "5": 1161, "6": 6611, "7": 1048 }, "total_department_totals_relative": { "1": 30962.876996916584, "2": 28790.813863868243, "3": 32997.60337384933, "4": 15442.430865260254, "5": 1407.808993176734, "6": 9521.78041528052, "7": 1010.6854916483431 }, "total_department_totals_parsed": { "Glostrup": 17009, "Taastrup": 22687, "Hvidovre": 11826, "Roskilde": 6611, "Køge": 12457, "Aarhus C": 1161, "Taulov": 1048 }, "total_department_totals_relative_parsed": { "Glostrup": 32997.60337384933, "Taastrup": 28790.813863868243, "Hvidovre": 30962.876996916584, "Roskilde": 9521.78041528052, "Køge": 15442.430865260254, "Aarhus C": 1407.808993176734, "Taulov": 1010.6854916483431 } } */ } else { console.error('Unexpected response structure:', response); + fixedPricingDistributionFailed.value = true; } }).catch((error) => { console.error('Error fetching fixed pricing distribution:', error); + fixedPricingDistributionLoaded.value = true; + fixedPricingDistributionFailed.value = true; }); } const clearFixedPricingDistribution = () => { @@ -134,7 +143,11 @@ watch( * Subscription display logic: */ const vehicleSubscriptionDistribution = ref(null); +const vehicleSubscriptionDistributionLoaded = ref(false); +const vehicleSubscriptionDistributionFailed = ref(false); const fetchVehicleSubscriptionDistribution = async () => { + vehicleSubscriptionDistributionLoaded.value = false; + vehicleSubscriptionDistributionFailed.value = false; SessionUser.request( '/superuser/invoicing/period/distribution/wash-subscriptions', 'GET', @@ -150,9 +163,12 @@ const fetchVehicleSubscriptionDistribution = async () => { vehicleSubscriptionDistribution.value = response.data.includes.collective_subscription_results; } else { console.error('Unexpected response structure:', response); + vehicleSubscriptionDistributionFailed.value = true; } }).catch((error) => { console.error('Error fetching vehicle subscription distribution:', error); + vehicleSubscriptionDistributionLoaded.value = true; + vehicleSubscriptionDistributionFailed.value = true; }); } const clearVehicleSubscriptionDistribution = () => {