Skip to content

Commit 6135e87

Browse files
committed
Calendar: include current events in event loading - refs BT#22682
1 parent 56ef210 commit 6135e87

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

assets/vue/composables/calendar/calendarEvent.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,30 @@ async function getCalendarEvents(startDate, endDate, commonParams) {
114114
"endDate[after]": startDate.toISOString(),
115115
})
116116

117+
const currentEventsPromise = requestCalendarEvents({
118+
...commonParams,
119+
"startDate[before]": startDate.toISOString(),
120+
"endDate[after]": endDate.toISOString(),
121+
})
122+
117123
const startingEventsPromise = requestCalendarEvents({
118124
...commonParams,
119125
"startDate[before]": endDate.toISOString(),
120126
"startDate[after]": startDate.toISOString(),
121127
})
122128

123-
const [endingEvents, startingEvents] = await Promise.all([endingEventsPromise, startingEventsPromise])
129+
const [endingEvents, currentEvents, startingEvents] = await Promise.all([
130+
endingEventsPromise,
131+
currentEventsPromise,
132+
startingEventsPromise,
133+
])
124134

125135
const uniqueEventsMap = new Map()
126136

127-
endingEvents.concat(startingEvents).forEach((event) => uniqueEventsMap.set(event.id, event))
137+
endingEvents
138+
.concat(startingEvents)
139+
.concat(currentEvents)
140+
.forEach((event) => uniqueEventsMap.set(event.id, event))
128141

129142
return Array.from(uniqueEventsMap.values())
130143
}

0 commit comments

Comments
 (0)