From 952883247efa06f01ea7f249f21c7cb86eee314e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Camblor?= Date: Wed, 20 Nov 2024 15:03:49 +0100 Subject: [PATCH] Talks' room should now be facultative --- cloud/functions/src/crawlers/crawl.ts | 2 +- .../firestore/services/stats-utils.ts | 2 +- .../legacy/deprecatedPublicEventStats.ts | 3 ++- .../http/event/refreshRecordingAssets.ts | 20 +++++++++++-------- .../src/functions/http/event/roomStats.ts | 2 +- .../src/functions/http/event/topTalks.ts | 3 ++- .../src/components/events/EventTalksGroup.vue | 2 +- .../feedbacks/FeedbackTalkSelector.vue | 2 +- .../schedule/FavoritesTimeslotSection.vue | 9 ++++----- .../schedule/ScheduleTimeslotAccordion.vue | 4 ++-- mobile/src/components/talk-card/TalkRoom.vue | 4 ++-- .../talk-details/TalkDetailsHeader.vue | 6 ++---- mobile/src/models/VoxxrinSchedule.ts | 4 +++- mobile/src/models/VoxxrinSpeaker.ts | 4 ++-- mobile/src/models/VoxxrinTalk.ts | 20 ++++++++++++++----- mobile/src/views/SpeakerDetailsPage.vue | 3 ++- mobile/src/views/TalkDetailsPage.vue | 4 ++-- mobile/src/views/event/FeedbacksPage.vue | 2 +- .../src/views/event/SpeakersDirectoryPage.vue | 3 ++- mobile/src/views/feedbacks/RateTalkPage.vue | 2 +- shared/daily-schedule.firestore.d.ts | 2 +- shared/event-lineup.firestore.d.ts | 2 +- 22 files changed, 61 insertions(+), 44 deletions(-) diff --git a/cloud/functions/src/crawlers/crawl.ts b/cloud/functions/src/crawlers/crawl.ts index 400da2ec..58e15647 100644 --- a/cloud/functions/src/crawlers/crawl.ts +++ b/cloud/functions/src/crawlers/crawl.ts @@ -223,7 +223,7 @@ export function sanityCheckEvent(event: FullEvent) { if(!descriptorFormatIds.includes(talk.format.id)) { unknownValues.unknownFormats.set(talk.format.id, talk.format); } - if(!descriptorRoomIds.includes(talk.room.id)) { + if(talk.room && !descriptorRoomIds.includes(talk.room.id)) { unknownValues.unknownRooms.set(talk.room.id, talk.room); } talkLangs.add(talk.language); diff --git a/cloud/functions/src/functions/firestore/services/stats-utils.ts b/cloud/functions/src/functions/firestore/services/stats-utils.ts index 96ce52c4..ff7abde1 100644 --- a/cloud/functions/src/functions/firestore/services/stats-utils.ts +++ b/cloud/functions/src/functions/firestore/services/stats-utils.ts @@ -17,7 +17,7 @@ export async function ensureRoomsStatsFilledFor(spaceToken: string|undefined, ev const timeslottedTalks = await getTimeslottedTalks(spaceToken, eventId) const roomsStats = timeslottedTalks.reduce((roomsStats, talk) => { - if(talk.room.id) { + if(talk.room?.id) { const encodedRoomId = toValidFirebaseKey(talk.room.id); if(!roomsStats[encodedRoomId]) { roomsStats[encodedRoomId] = { diff --git a/cloud/functions/src/functions/http/event/legacy/deprecatedPublicEventStats.ts b/cloud/functions/src/functions/http/event/legacy/deprecatedPublicEventStats.ts index bb40bfcd..c42eb061 100644 --- a/cloud/functions/src/functions/http/event/legacy/deprecatedPublicEventStats.ts +++ b/cloud/functions/src/functions/http/event/legacy/deprecatedPublicEventStats.ts @@ -129,7 +129,8 @@ export async function legacyPublicEventStats(request: functions.https.Request, r start: talk.start, end: talk.end, format: talk.format.title, language: talk.language, - room: talk.room.title, track: talk.track.title, + room: talk.room?.title, + track: talk.track.title, tags: [], // TODO: remove this once we're OK that it's not used by callers averageRating: talk.averageRating, numberOfVotes: talk.numberOfVotes diff --git a/cloud/functions/src/functions/http/event/refreshRecordingAssets.ts b/cloud/functions/src/functions/http/event/refreshRecordingAssets.ts index 3054f82c..d0f80c9b 100644 --- a/cloud/functions/src/functions/http/event/refreshRecordingAssets.ts +++ b/cloud/functions/src/functions/http/event/refreshRecordingAssets.ts @@ -36,7 +36,8 @@ export async function requestRecordingAssetsRefresh(response: Response, pathPara const eventTalks = await getEventTalks(spaceToken, eventId); const filteredEventTalks = eventTalks .filter(talk => - !(recordingConfig.notRecordedFormatIds || []).includes(talk.format.id) + talk.room + && !(recordingConfig.notRecordedFormatIds || []).includes(talk.format.id) && !(recordingConfig.notRecordedRoomIds || []).includes(talk.room.id) && (!recordingConfig.recordedFormatIds || recordingConfig.recordedFormatIds.includes(talk.format.id)) && (!recordingConfig.recordedRoomIds || recordingConfig.recordedRoomIds.includes(talk.room.id)) @@ -233,13 +234,16 @@ export const ${exportedVarName} = ${JSON.stringify({ '__videoTitle': mt.video.title, talkId: mt.talk.id, videoId: mt.video.id })), - expectedUnmappedTalks: results.unmatchedTalks.map(({talk: ut}) => ({ - '__talkTitle': ut.title, - '__talkFormat': `${talkById.get(ut.id)!.format.title} (id=${talkById.get(ut.id)!.format.id}, duration=${talkById.get(ut.id)!.format.duration})`, - '__talkRoom': `${talkById.get(ut.id)!.room.title} (${talkById.get(ut.id)!.room.id})`, - '__talkSpeakers': ut.speakers.map(sp => sp.fullName).join(", "), - talkId: ut.id - })), + expectedUnmappedTalks: results.unmatchedTalks.map(({talk: ut}) => { + const talk = talkById.get(ut.id)! + return { + '__talkTitle': ut.title, + '__talkFormat': `${talk.format.title} (id=${talk.format.id}, duration=${talk.format.duration})`, + '__talkRoom': talk.room ? `${talk.room.title} (${talk.room.id})` : undefined, + '__talkSpeakers': ut.speakers.map(sp => sp.fullName).join(", "), + talkId: ut.id + }; + }), unmappedYoutubeVideos: results.unmatchedYoutubeVideos.map(vid => ({ id: vid.id, publishedAt: vid.publishedAt, duration: vid.duration, title: vid.title } satisfies YoutubeVideo)), diff --git a/cloud/functions/src/functions/http/event/roomStats.ts b/cloud/functions/src/functions/http/event/roomStats.ts index 035f5ad2..2a4a29d3 100644 --- a/cloud/functions/src/functions/http/event/roomStats.ts +++ b/cloud/functions/src/functions/http/event/roomStats.ts @@ -66,7 +66,7 @@ async function updateRoomStatsFor(params: { spaceToken: string|undefined, eventI const talkCandidates = params.timeslottedTalks .filter(tt => { - return tt.room.id === params.roomId + return tt.room?.id === params.roomId && recordingTimestamp <= maxTalkCompletionTimestampToBeConsideredACandidateForCapacityFillingRatio(tt) && recordingTimestamp + 3*60*60*1000 > Date.parse(tt.start) }).sort((tt1, tt2) => Date.parse(tt1.start) - Date.parse(tt2.start)); diff --git a/cloud/functions/src/functions/http/event/topTalks.ts b/cloud/functions/src/functions/http/event/topTalks.ts index 50f5a6aa..5529755f 100644 --- a/cloud/functions/src/functions/http/event/topTalks.ts +++ b/cloud/functions/src/functions/http/event/topTalks.ts @@ -95,7 +95,8 @@ export async function eventTopTalks(response: Response, pathParams: {eventId: st start: talk.start, end: talk.end, format: talk.format.title, language: talk.language, - room: talk.room.title, track: talk.track.title, + room: talk.room?.title, + track: talk.track.title, tags: [], // TODO: remove this once we're OK that it's not used by callers averageRating: talk.averageRating, numberOfVotes: talk.numberOfVotes diff --git a/mobile/src/components/events/EventTalksGroup.vue b/mobile/src/components/events/EventTalksGroup.vue index aa028003..fb05980d 100644 --- a/mobile/src/components/events/EventTalksGroup.vue +++ b/mobile/src/components/events/EventTalksGroup.vue @@ -4,7 +4,7 @@ diff --git a/mobile/src/components/feedbacks/FeedbackTalkSelector.vue b/mobile/src/components/feedbacks/FeedbackTalkSelector.vue index bd31a3c0..572265d5 100644 --- a/mobile/src/components/feedbacks/FeedbackTalkSelector.vue +++ b/mobile/src/components/feedbacks/FeedbackTalkSelector.vue @@ -3,7 +3,7 @@