chore: Outlook `processBusyTimes` iterate busy times once (#11350)

pull/11364/head
Joe Au-Yeung 2023-09-14 08:56:31 -04:00 committed by GitHub
parent 49364eee9a
commit bb0574dff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -454,12 +454,13 @@ export default class Office365CalendarService implements Calendar {
(acc: BufferedBusyTime[], subResponse: { body: { value?: BodyValue[]; error?: Error[] } }) => {
if (!subResponse.body?.value) return acc;
return acc.concat(
subResponse.body.value
.filter((evt) => evt.showAs !== "free" && evt.showAs !== "workingElsewhere")
.map((evt) => ({
subResponse.body.value.reduce((acc: BufferedBusyTime[], evt: BodyValue) => {
if (evt.showAs === "free" || evt.showAs === "workingElsewhere") return acc;
return acc.concat({
start: evt.start.dateTime + "Z",
end: evt.end.dateTime + "Z",
}))
});
}, [])
);
},
[]