fix(pleno-vue): consistent error state tracking in InvoicingBillingPeriodStatistics (#275)

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.
This commit is contained in:
Jeppe B
2026-08-11 07:14:47 +02:00
committed by GitHub
parent e08f1ecba8
commit e4bd3420c6
@@ -35,7 +35,11 @@ const getResponsePayload = (response: any = {}) => {
* Fixed pricing distribution data structure:
*/
const fixed_pricing_department_distribution = ref<any[]>([]);
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<any>(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 = () => {