fix(schedule): calendar
This commit is contained in:
@ -59,266 +59,6 @@ export class ScheduleModel {
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static async getScheduleCalendarRange(start: string, end: string, filterObj = {}, options: CalendarQueryOptions = {}): Promise<any> {
|
|
||||||
// const startDate = new Date(start);
|
|
||||||
// const endDate = new Date(end);
|
|
||||||
// if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
|
|
||||||
// throw new Error("Invalid start or end date");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const rangeStart = ScheduleModel.startOfDay(startDate);
|
|
||||||
// const rangeEnd = ScheduleModel.endOfDay(endDate);
|
|
||||||
// if (rangeStart > rangeEnd) {
|
|
||||||
// throw new Error("Start date must be before end date");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const seriesQuery = await ScheduleModel.listSeries(filterObj);
|
|
||||||
// seriesQuery
|
|
||||||
// .andWhere("ScheduleSeries.start_date <= :rangeEndDate", { rangeEndDate: ScheduleModel.formatYmd(rangeEnd) })
|
|
||||||
// .andWhere("(ScheduleSeries.until_date IS NULL OR ScheduleSeries.until_date >= :rangeStartDate)", {
|
|
||||||
// rangeStartDate: ScheduleModel.formatYmd(rangeStart),
|
|
||||||
// })
|
|
||||||
// .andWhere("ScheduleSeries.deleted_at IS NULL");
|
|
||||||
|
|
||||||
// const seriesList: ScheduleSeries[] = await seriesQuery.getMany();
|
|
||||||
// if (seriesList.length === 0) return { resources: [], events: [] };
|
|
||||||
|
|
||||||
// const seriesIds = seriesList.map((series) => series.id);
|
|
||||||
// const usageMap = await ScheduleModel.getDailyUsedQuotaMap(seriesIds, rangeStart, rangeEnd);
|
|
||||||
// const exceptionRepo = OrmHelper.DB.getRepository(ScheduleException);
|
|
||||||
// const exceptions = await exceptionRepo
|
|
||||||
// .createQueryBuilder("ScheduleException")
|
|
||||||
// .leftJoinAndSelect("ScheduleException.override_room", "OverrideRoom")
|
|
||||||
// .leftJoinAndSelect("ScheduleException.override_doctor", "OverrideDoctor")
|
|
||||||
// .where("ScheduleException.series_id IN (:...seriesIds)", { seriesIds })
|
|
||||||
// .andWhere("ScheduleException.occurrence_date BETWEEN :rangeStart AND :rangeEnd", {
|
|
||||||
// rangeStart: ScheduleModel.formatYmd(rangeStart),
|
|
||||||
// rangeEnd: ScheduleModel.formatYmd(rangeEnd),
|
|
||||||
// })
|
|
||||||
// .andWhere("ScheduleException.deleted_at IS NULL")
|
|
||||||
// .getMany();
|
|
||||||
|
|
||||||
// const exceptionMap = new Map<string, ScheduleException>();
|
|
||||||
// for (const ex of exceptions) {
|
|
||||||
// const key = `${ex.series_id}:${ScheduleModel.formatYmd(new Date(ex.occurrence_date))}`;
|
|
||||||
// exceptionMap.set(key, ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const allEvents: any[] = [];
|
|
||||||
|
|
||||||
// for (const series of seriesList) {
|
|
||||||
// const occurrenceDates = ScheduleModel.expandSeriesOccurrences(series, rangeStart, rangeEnd);
|
|
||||||
// for (const occurrenceDate of occurrenceDates) {
|
|
||||||
// const occurrenceYmd = ScheduleModel.formatYmd(occurrenceDate);
|
|
||||||
// const exception = exceptionMap.get(`${series.id}:${occurrenceYmd}`);
|
|
||||||
// if (exception && exception.is_cancelled) continue;
|
|
||||||
|
|
||||||
// const defaultStart = ScheduleModel.combineDateAndTime(occurrenceYmd, series.start_time);
|
|
||||||
// const defaultEnd = ScheduleModel.combineDateAndTime(occurrenceYmd, series.end_time);
|
|
||||||
|
|
||||||
// // const doctor = exception?.override_doctor ?? series.doctor;
|
|
||||||
// const room = exception?.override_room ?? series.room;
|
|
||||||
// const eventStart = exception?.override_start_at ? new Date(exception.override_start_at) : defaultStart;
|
|
||||||
// const eventEnd = exception?.override_end_at ? new Date(exception.override_end_at) : defaultEnd;
|
|
||||||
// const eventTitle = exception?.override_title || series.title;
|
|
||||||
|
|
||||||
// const roomId = room?.id || null;
|
|
||||||
// // const doctorId = doctor?.id || null;
|
|
||||||
// const resourceId = `${roomId || "unknown-room"}`;
|
|
||||||
// // const resourceId = `${roomId || "unknown-room"}:${doctorId || "unknown-doctor"}`;
|
|
||||||
// const roomName = (room as any)?.room || (room as any)?.name || (room as any)?.code || "";
|
|
||||||
// // const doctorName = (doctor as any)?.name || (doctor as any)?.fullname || (doctor as any)?.username || "";
|
|
||||||
|
|
||||||
// allEvents.push({
|
|
||||||
// id: `occ:${series.id}:${occurrenceYmd}`,
|
|
||||||
// seriesId: series.id,
|
|
||||||
// resourceId,
|
|
||||||
// title: eventTitle,
|
|
||||||
// startAt: eventStart.toISOString(),
|
|
||||||
// endAt: eventEnd.toISOString(),
|
|
||||||
// quota: series.quota ?? null,
|
|
||||||
// usedQuota: usageMap.get(`${series.id}:${occurrenceYmd}`) || 0,
|
|
||||||
// leftQuota:
|
|
||||||
// typeof series.quota === "number"
|
|
||||||
// ? Math.max(0, series.quota - (usageMap.get(`${series.id}:${occurrenceYmd}`) || 0))
|
|
||||||
// : null,
|
|
||||||
// isRecurring: !!series.recurrence_rule,
|
|
||||||
// isException: !!exception,
|
|
||||||
// status: "confirmed",
|
|
||||||
// _resource: {
|
|
||||||
// id: resourceId,
|
|
||||||
// roomId,
|
|
||||||
// roomName,
|
|
||||||
// // doctorId,
|
|
||||||
// // doctorName,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const allResourcesMap = new Map<string, any>();
|
|
||||||
// for (const event of allEvents) {
|
|
||||||
// allResourcesMap.set(event._resource.id, event._resource);
|
|
||||||
// }
|
|
||||||
// const allResources = [...allResourcesMap.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
||||||
// const totalCount = allResources.length;
|
|
||||||
// const page = options.page ?? 1;
|
|
||||||
// const limit = options.limit ?? totalCount;
|
|
||||||
// const offset = (page - 1) * limit;
|
|
||||||
// const pagedResources = allResources.slice(offset, offset + limit);
|
|
||||||
// const allowedResourceIds = new Set(pagedResources.map((resource) => resource.id));
|
|
||||||
|
|
||||||
// const pagedEvents = allEvents
|
|
||||||
// .filter((event) => allowedResourceIds.has(event.resourceId))
|
|
||||||
// .sort((a, b) => {
|
|
||||||
// if (a.startAt === b.startAt) return a.id.localeCompare(b.id);
|
|
||||||
// return a.startAt.localeCompare(b.startAt);
|
|
||||||
// })
|
|
||||||
// .map((event) => {
|
|
||||||
// const { _resource, ...cleanEvent } = event;
|
|
||||||
// return cleanEvent;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// resources: pagedResources,
|
|
||||||
// events: pagedEvents,
|
|
||||||
// meta: {
|
|
||||||
// total_count: totalCount,
|
|
||||||
// page,
|
|
||||||
// limit,
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return resource as rooms and all the events with relation of room and doctor
|
|
||||||
// static async getScheduleCalendarRange(start: string, end: string, filterObj = {}, options: CalendarQueryOptions = {}): Promise<any> {
|
|
||||||
// const startDate = dayjs(start);
|
|
||||||
// const endDate = dayjs(end);
|
|
||||||
// if (!startDate.isValid() || !endDate.isValid()) {
|
|
||||||
// throw new Error("Invalid start or end date");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const rangeStart = startDate.startOf("day").toDate();
|
|
||||||
// const rangeEnd = endDate.endOf("day").toDate();
|
|
||||||
// if (rangeStart > rangeEnd) {
|
|
||||||
// throw new Error("Start date must be before end date");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const seriesQuery = await ScheduleModel.listSeries(filterObj);
|
|
||||||
// seriesQuery
|
|
||||||
// .andWhere("ScheduleSeries.start_date <= :rangeEndDate", { rangeEndDate: dayjs(rangeEnd).format("YYYY-MM-DD") })
|
|
||||||
// .andWhere("(ScheduleSeries.until_date IS NULL OR ScheduleSeries.until_date >= :rangeStartDate)", {
|
|
||||||
// rangeStartDate: dayjs(rangeStart).format("YYYY-MM-DD"),
|
|
||||||
// })
|
|
||||||
// .andWhere("ScheduleSeries.deleted_at IS NULL");
|
|
||||||
|
|
||||||
// const seriesList: ScheduleSeries[] = await seriesQuery.getMany();
|
|
||||||
// if (seriesList.length === 0) return { rooms: [], events: [] };
|
|
||||||
|
|
||||||
// const seriesIds = seriesList.map((series) => series.id);
|
|
||||||
// const usageMap = await ScheduleModel.getDailyUsedQuotaMap(seriesIds, rangeStart, rangeEnd);
|
|
||||||
// const exceptionRepo = OrmHelper.DB.getRepository(ScheduleException);
|
|
||||||
// const exceptions = await exceptionRepo
|
|
||||||
// .createQueryBuilder("ScheduleException")
|
|
||||||
// .leftJoinAndSelect("ScheduleException.override_room", "OverrideRoom")
|
|
||||||
// .leftJoinAndSelect("ScheduleException.override_doctor", "OverrideDoctor")
|
|
||||||
// .where("ScheduleException.series_id IN (:...seriesIds)", { seriesIds })
|
|
||||||
// .andWhere("ScheduleException.occurrence_date BETWEEN :rangeStart AND :rangeEnd", {
|
|
||||||
// rangeStart: ScheduleModel.formatYmd(rangeStart),
|
|
||||||
// rangeEnd: ScheduleModel.formatYmd(rangeEnd),
|
|
||||||
// })
|
|
||||||
// .andWhere("ScheduleException.deleted_at IS NULL")
|
|
||||||
// .getMany();
|
|
||||||
|
|
||||||
// const exceptionMap = new Map<string, ScheduleException>();
|
|
||||||
// for (const ex of exceptions) {
|
|
||||||
// const key = `${ex.series_id}:${dayjs(ex.occurrence_date).format("YYYY-MM-DD")}`;
|
|
||||||
// exceptionMap.set(key, ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const allEvents: any[] = [];
|
|
||||||
|
|
||||||
// for (const series of seriesList) {
|
|
||||||
// const occurrenceDates = ScheduleModel.expandSeriesOccurrences(series, rangeStart, rangeEnd);
|
|
||||||
// for (const occurrenceDate of occurrenceDates) {
|
|
||||||
// const occurrenceYmd = dayjs(occurrenceDate).format("YYYY-MM-DD");
|
|
||||||
// const exception = exceptionMap.get(`${series.id}:${occurrenceYmd}`);
|
|
||||||
// if (exception && exception.is_cancelled) continue;
|
|
||||||
|
|
||||||
// const defaultStart = ScheduleModel.combineDateAndTime(occurrenceYmd, series.start_time);
|
|
||||||
// const defaultEnd = ScheduleModel.combineDateAndTime(occurrenceYmd, series.end_time);
|
|
||||||
|
|
||||||
// const doctor = exception?.override_doctor ?? series.doctor;
|
|
||||||
// const room = exception?.override_room ?? series.room;
|
|
||||||
// const eventStart = exception?.override_start_at ? new Date(exception.override_start_at) : defaultStart;
|
|
||||||
// const eventEnd = exception?.override_end_at ? new Date(exception.override_end_at) : defaultEnd;
|
|
||||||
// const eventTitle = exception?.override_title || series.title;
|
|
||||||
|
|
||||||
// const roomId = room?.id || null;
|
|
||||||
// const doctorId = doctor?.id || null;
|
|
||||||
// const roomName = (room as any)?.room || (room as any)?.name || (room as any)?.code || "";
|
|
||||||
// const doctorName = (doctor as any)?.name || (doctor as any)?.fullname || (doctor as any)?.username || "";
|
|
||||||
|
|
||||||
// allEvents.push({
|
|
||||||
// id: `occ:${series.id}:${occurrenceYmd}`,
|
|
||||||
// seriesId: series.id,
|
|
||||||
// roomId,
|
|
||||||
// doctorId,
|
|
||||||
// doctorName,
|
|
||||||
// title: eventTitle,
|
|
||||||
// startAt: eventStart.toISOString(),
|
|
||||||
// endAt: eventEnd.toISOString(),
|
|
||||||
// quota: series.quota ?? null,
|
|
||||||
// usedQuota: usageMap.get(`${series.id}:${occurrenceYmd}`) || 0,
|
|
||||||
// leftQuota:
|
|
||||||
// typeof series.quota === "number"
|
|
||||||
// ? Math.max(0, series.quota - (usageMap.get(`${series.id}:${occurrenceYmd}`) || 0))
|
|
||||||
// : null,
|
|
||||||
// isRecurring: !!series.recurrence_rule,
|
|
||||||
// isException: !!exception,
|
|
||||||
// status: "confirmed",
|
|
||||||
// _room: {
|
|
||||||
// id: roomId,
|
|
||||||
// name: roomName,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const allRoomsMap = new Map<string, any>();
|
|
||||||
// for (const event of allEvents) {
|
|
||||||
// allRoomsMap.set(event._room.id, event._room);
|
|
||||||
// }
|
|
||||||
// const allRooms = [...allRoomsMap.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
||||||
// const totalCount = allRooms.length;
|
|
||||||
// const page = options.page ?? 1;
|
|
||||||
// const limit = options.limit ?? totalCount;
|
|
||||||
// const offset = (page - 1) * limit;
|
|
||||||
// const pagedRooms = allRooms.slice(offset, offset + limit);
|
|
||||||
// const allowedRoomIds = new Set(pagedRooms.map((room) => room.id));
|
|
||||||
|
|
||||||
// const pagedEvents = allEvents
|
|
||||||
// .filter((event) => allowedRoomIds.has(event.roomId))
|
|
||||||
// .sort((a, b) => {
|
|
||||||
// if (a.startAt === b.startAt) return a.id.localeCompare(b.id);
|
|
||||||
// return a.startAt.localeCompare(b.startAt);
|
|
||||||
// })
|
|
||||||
// .map((event) => {
|
|
||||||
// const { _room, ...cleanEvent } = event;
|
|
||||||
// return cleanEvent;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// rooms: pagedRooms,
|
|
||||||
// events: pagedEvents,
|
|
||||||
// meta: {
|
|
||||||
// total_count: totalCount,
|
|
||||||
// page,
|
|
||||||
// limit,
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
static async getScheduleCalendarRange(start: string, end: string, filterObj = {}, options: CalendarQueryOptions = {}): Promise<any> {
|
static async getScheduleCalendarRange(start: string, end: string, filterObj = {}, options: CalendarQueryOptions = {}): Promise<any> {
|
||||||
const startDate = dayjs(start);
|
const startDate = dayjs(start);
|
||||||
const endDate = dayjs(end);
|
const endDate = dayjs(end);
|
||||||
@ -358,72 +98,72 @@ export class ScheduleModel {
|
|||||||
.andWhere("ScheduleSeries.deleted_at IS NULL")
|
.andWhere("ScheduleSeries.deleted_at IS NULL")
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
if (seriesList.length === 0) return { rooms: rooms, events: [], meta: { total_count: rooms.length, page, limit } };
|
|
||||||
const seriesIds = seriesList.map((series) => series.id);
|
|
||||||
const usageMap = await ScheduleModel.getDailyUsedQuotaMap(seriesIds, rangeStart, rangeEnd);
|
|
||||||
|
|
||||||
const exceptionRepo = OrmHelper.DB.getRepository(ScheduleException);
|
|
||||||
const exceptions = await exceptionRepo
|
|
||||||
.createQueryBuilder("ScheduleException")
|
|
||||||
.leftJoinAndSelect("ScheduleException.override_room", "OverrideRoom")
|
|
||||||
.leftJoinAndSelect("ScheduleException.override_doctor", "OverrideDoctor")
|
|
||||||
.where("ScheduleException.series_id IN (:...seriesIds)", { seriesIds })
|
|
||||||
.andWhere("ScheduleException.occurrence_date BETWEEN :rangeStart AND :rangeEnd", {
|
|
||||||
rangeStart: ScheduleModel.formatYmd(rangeStart),
|
|
||||||
rangeEnd: ScheduleModel.formatYmd(rangeEnd),
|
|
||||||
})
|
|
||||||
.andWhere("ScheduleException.deleted_at IS NULL")
|
|
||||||
.getMany();
|
|
||||||
|
|
||||||
const exceptionMap = new Map<string, ScheduleException>();
|
|
||||||
for (const ex of exceptions) {
|
|
||||||
const key = `${ex.series_id}:${dayjs(ex.occurrence_date).format("YYYY-MM-DD")}`;
|
|
||||||
exceptionMap.set(key, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
const allEvents: any[] = [];
|
const allEvents: any[] = [];
|
||||||
|
if (seriesList.length > 0) {
|
||||||
|
const seriesIds = seriesList.map((series) => series.id);
|
||||||
|
const usageMap = await ScheduleModel.getDailyUsedQuotaMap(seriesIds, rangeStart, rangeEnd);
|
||||||
|
|
||||||
for (const series of seriesList) {
|
const exceptionRepo = OrmHelper.DB.getRepository(ScheduleException);
|
||||||
const occurrenceDates = ScheduleModel.expandSeriesOccurrences(series, rangeStart, rangeEnd);
|
const exceptions = await exceptionRepo
|
||||||
for (const occurrenceDate of occurrenceDates) {
|
.createQueryBuilder("ScheduleException")
|
||||||
const occurrenceYmd = dayjs(occurrenceDate).format("YYYY-MM-DD");
|
.leftJoinAndSelect("ScheduleException.override_room", "OverrideRoom")
|
||||||
const exception = exceptionMap.get(`${series.id}:${occurrenceYmd}`);
|
.leftJoinAndSelect("ScheduleException.override_doctor", "OverrideDoctor")
|
||||||
if (exception && exception.is_cancelled) continue;
|
.where("ScheduleException.series_id IN (:...seriesIds)", { seriesIds })
|
||||||
|
.andWhere("ScheduleException.occurrence_date BETWEEN :rangeStart AND :rangeEnd", {
|
||||||
|
rangeStart: ScheduleModel.formatYmd(rangeStart),
|
||||||
|
rangeEnd: ScheduleModel.formatYmd(rangeEnd),
|
||||||
|
})
|
||||||
|
.andWhere("ScheduleException.deleted_at IS NULL")
|
||||||
|
.getMany();
|
||||||
|
|
||||||
const defaultStart = ScheduleModel.combineDateAndTime(occurrenceYmd, series.start_time);
|
const exceptionMap = new Map<string, ScheduleException>();
|
||||||
const defaultEnd = ScheduleModel.combineDateAndTime(occurrenceYmd, series.end_time);
|
for (const ex of exceptions) {
|
||||||
|
const key = `${ex.series_id}:${dayjs(ex.occurrence_date).format("YYYY-MM-DD")}`;
|
||||||
|
exceptionMap.set(key, ex);
|
||||||
|
}
|
||||||
|
|
||||||
const doctor = exception?.override_doctor ?? series.doctor;
|
for (const series of seriesList) {
|
||||||
const room = exception?.override_room ?? series.room;
|
const occurrenceDates = ScheduleModel.expandSeriesOccurrences(series, rangeStart, rangeEnd);
|
||||||
const eventStart = exception?.override_start_at ? new Date(exception.override_start_at) : defaultStart;
|
for (const occurrenceDate of occurrenceDates) {
|
||||||
const eventEnd = exception?.override_end_at ? new Date(exception.override_end_at) : defaultEnd;
|
const occurrenceYmd = dayjs(occurrenceDate).format("YYYY-MM-DD");
|
||||||
const eventTitle = exception?.override_title || series.title;
|
const exception = exceptionMap.get(`${series.id}:${occurrenceYmd}`);
|
||||||
|
if (exception && exception.is_cancelled) continue;
|
||||||
|
|
||||||
const roomId = room?.id || null;
|
const defaultStart = ScheduleModel.combineDateAndTime(occurrenceYmd, series.start_time);
|
||||||
const doctorId = doctor?.id || null;
|
const defaultEnd = ScheduleModel.combineDateAndTime(occurrenceYmd, series.end_time);
|
||||||
const roomName = (room as any)?.room || (room as any)?.name || (room as any)?.code || "";
|
|
||||||
const doctorName = (doctor as any)?.name || (doctor as any)?.fullname || (doctor as any)?.username || "";
|
|
||||||
|
|
||||||
allEvents.push({
|
const doctor = exception?.override_doctor ?? series.doctor;
|
||||||
id: `occ:${series.id}:${occurrenceYmd}`,
|
const room = exception?.override_room ?? series.room;
|
||||||
series_id: series.id,
|
const eventStart = exception?.override_start_at ? new Date(exception.override_start_at) : defaultStart;
|
||||||
title: eventTitle,
|
const eventEnd = exception?.override_end_at ? new Date(exception.override_end_at) : defaultEnd;
|
||||||
room_id: roomId,
|
const eventTitle = exception?.override_title || series.title;
|
||||||
room_name: roomName,
|
|
||||||
doctor_id: doctorId,
|
const roomId = room?.id || null;
|
||||||
doctor_name: doctorName,
|
const doctorId = doctor?.id || null;
|
||||||
start_at: eventStart.toISOString(),
|
const roomName = (room as any)?.room || (room as any)?.name || (room as any)?.code || "";
|
||||||
end_at: eventEnd.toISOString(),
|
const doctorName = (doctor as any)?.name || (doctor as any)?.fullname || (doctor as any)?.username || "";
|
||||||
quota: series.quota ?? null,
|
|
||||||
used_quota: usageMap.get(`${series.id}:${occurrenceYmd}`) || 0,
|
allEvents.push({
|
||||||
left_quota:
|
id: `occ:${series.id}:${occurrenceYmd}`,
|
||||||
typeof series.quota === "number"
|
series_id: series.id,
|
||||||
? Math.max(0, series.quota - (usageMap.get(`${series.id}:${occurrenceYmd}`) || 0))
|
title: eventTitle,
|
||||||
: null,
|
room_id: roomId,
|
||||||
is_recurring: !!series.recurrence_rule,
|
room_name: roomName,
|
||||||
is_exception: !!exception,
|
doctor_id: doctorId,
|
||||||
status: "confirmed",
|
doctor_name: doctorName,
|
||||||
});
|
start_at: eventStart.toISOString(),
|
||||||
|
end_at: eventEnd.toISOString(),
|
||||||
|
quota: series.quota ?? null,
|
||||||
|
used_quota: usageMap.get(`${series.id}:${occurrenceYmd}`) || 0,
|
||||||
|
left_quota:
|
||||||
|
typeof series.quota === "number"
|
||||||
|
? Math.max(0, series.quota - (usageMap.get(`${series.id}:${occurrenceYmd}`) || 0))
|
||||||
|
: null,
|
||||||
|
is_recurring: !!series.recurrence_rule,
|
||||||
|
is_exception: !!exception,
|
||||||
|
status: "confirmed",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user