refactor(booking): remove maintenance-related metrics and UI components

This commit is contained in:
Jose Selesan
2026-06-08 15:28:49 -03:00
parent b48dd4f15d
commit b2f9a14b87
10 changed files with 19 additions and 95 deletions

View File

@@ -210,20 +210,14 @@ function buildSegmentsForCourt(
function getSummary(schedules: BookingCourtSchedule[]): BookingSummary {
const freeSlots = schedules.reduce((total, schedule) => total + schedule.metrics.free, 0);
const reservedSlots = schedules.reduce((total, schedule) => total + schedule.metrics.reserved, 0);
const maintenanceSlots = schedules.reduce(
(total, schedule) => total + schedule.metrics.maintenance,
0
);
const totalSegments = freeSlots + reservedSlots + maintenanceSlots || 1;
const totalSegments = freeSlots + reservedSlots || 1;
return {
totalReservations: reservedSlots + maintenanceSlots + freeSlots,
totalReservations: freeSlots + reservedSlots,
freeSlots,
reservedSlots,
maintenanceSlots,
freePercent: Math.round((freeSlots / totalSegments) * 100),
reservedPercent: Math.round((reservedSlots / totalSegments) * 100),
maintenancePercent: Math.round((maintenanceSlots / totalSegments) * 100),
};
}
@@ -275,7 +269,6 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
const metrics = {
free: segments.filter((segment) => segment.status === 'free').length,
reserved: segments.filter((segment) => segment.status === 'reserved').length,
maintenance: segments.filter((segment) => segment.status === 'maintenance').length,
};
return { court, segments, metrics };