Skip to content

Commit

Permalink
Talks' room should now be facultative
Browse files Browse the repository at this point in the history
  • Loading branch information
fcamblor committed Jan 29, 2025
1 parent ca5bbfd commit 9528832
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 44 deletions.
2 changes: 1 addition & 1 deletion cloud/functions/src/crawlers/crawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions cloud/functions/src/functions/http/event/refreshRecordingAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)),
Expand Down
2 changes: 1 addition & 1 deletion cloud/functions/src/functions/http/event/roomStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion cloud/functions/src/functions/http/event/topTalks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/components/events/EventTalksGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<talk-card v-for="(talk, index) in talks" :key="talk.id.value"
:conf-descriptor="confDescriptor" :is-highlighted="() => false"
:talk="talk" :room-id="talk.room.id"
:talk="talk" :room-id="talk.room?.id"
:talk-notes="userEventTalkNotesRef.get(talk.id.value)"
@click="emits('talk-clicked', talk)"
scope="event-talks">
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/components/feedbacks/FeedbackTalkSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<talk-format-groups-breakdown :conf-descriptor="confDescriptor" :talks="displayedTalksRef">
<template #talk="{ talk }">
<ion-item class="listTalks-item">
<talk-card :talk="talk" :room-id="talk.room.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" :talk-notes="userTalkNotesRefByTalkIdRef.get(talk.id.value)"
<talk-card :talk="talk" :room-id="talk.room?.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" :talk-notes="userTalkNotesRefByTalkIdRef.get(talk.id.value)"
:is-highlighted="(talk, talkNotes) => talk.id.isSameThan(selectedTalkId)" :conf-descriptor="confDescriptor"
@talkClicked="updateSelected($event)" scope="rating">
<template #upper-right="{ talk, talkNotes }">
Expand Down
9 changes: 4 additions & 5 deletions mobile/src/components/schedule/FavoritesTimeslotSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
</no-results>
<talk-format-groups-breakdown :conf-descriptor="confDescriptor" v-if="timeslot.type==='talks'" :talks="timeslot.talks.filter(t => t.id.isIncludedIntoArray(favoritedTalkIdsRef))">
<template #talk="{ talk }">
<talk-card :talk="talk" :room-id="talk.room.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" :talk-notes="userEventTalkNotes.get(talk.id.value)"
<talk-card :talk="talk" :room-id="talk.room?.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" :talk-notes="userEventTalkNotes.get(talk.id.value)"
:is-highlighted="(talk, talkNotes) => talkNotes.isFavorite" :conf-descriptor="confDescriptor"
:room-stats="roomsStatsRefByRoomId?.[talk.room.id.value]" :is-upcoming-talk="upcomingRawTalkIds.includes(talk.id.value)"
:room-stats="talk.room ? roomsStatsRefByRoomId?.[talk.room.id.value] : undefined" :is-upcoming-talk="upcomingRawTalkIds.includes(talk.id.value)"
@talk-clicked="_ => $emit('talk-clicked', talk)" scope="favorites">
<template #upper-right="{ }">
<div class="room" v-if="confDescriptor?.features.roomsDisplayed">
{{talk.room.title}}
</div>
<talk-room :room="talk.room" :conf-descriptor="confDescriptor" />
</template>
<template #footer-actions="{ talkNotes, talkStats }">
<provide-feedback-talk-button v-if="!talk.isOverflow"
Expand Down Expand Up @@ -57,6 +55,7 @@ import {TalkNote} from "../../../../shared/feedbacks.firestore";
import {TalkId, VoxxrinTalk} from "@/models/VoxxrinTalk";
import NoResults from "@/components/ui/NoResults.vue";
import TimeSlotSection from "@/components/timeslots/TimeSlotSection.vue";
import TalkRoom from "@/components/talk-card/TalkRoom.vue";
const { LL } = typesafeI18n()
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/components/schedule/ScheduleTimeslotAccordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
:talks="timeslot.talks">
<template #talk="{ talk }">
<ion-item class="listTalks-item" role="listitem">
<talk-card :talk="talk" :room-id="talk.room.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" scope="schedule"
:room-stats="roomsStatsRefByRoomId?.[talk.room.id.value]" :is-upcoming-talk="upcomingRawTalkIds.includes(talk.id.value)"
<talk-card :talk="talk" :room-id="talk.room?.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)" scope="schedule"
:room-stats="talk.room ? roomsStatsRefByRoomId?.[talk.room.id.value] : undefined" :is-upcoming-talk="upcomingRawTalkIds.includes(talk.id.value)"
:talk-notes="userEventTalkNotes.get(talk.id.value)" @talk-clicked="(clickedTalk) => $emit('talk-clicked', talk)" :is-highlighted="(talk, talkNotes) => talkNotes.isFavorite" :conf-descriptor="confDescriptor">
<template #upper-right="{ }">
<talk-room :room="talk.room" :conf-descriptor="confDescriptor" />
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/components/talk-card/TalkRoom.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="room" v-if="confDescriptor?.features.roomsDisplayed">
<div class="room" v-if="confDescriptor?.features.roomsDisplayed && room">
<ion-icon aria-hidden="true" src="/assets/icons/solid/map-marker.svg"></ion-icon>
{{room.title}}
</div>
Expand All @@ -17,7 +17,7 @@ const props = defineProps({
},
room: {
required: true,
type: Object as PropType<VoxxrinRoom>
type: Object as PropType<VoxxrinRoom|undefined>
}
})
</script>
Expand Down
6 changes: 2 additions & 4 deletions mobile/src/components/talk-details/TalkDetailsHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
<span class="slot-schedule-end">{{timeslotLabel.end}}</span>
</ion-label>
</div>
<div class="subHeader-room" v-if="confDescriptor.features.roomsDisplayed">
<ion-icon aria-hidden="true" src="/assets/icons/solid/map-marker.svg"></ion-icon>
{{talk.room.title}}
</div>
<talk-room class="subHeader-room" :room="talk.room" :conf-descriptor="confDescriptor" />
</div>
</ion-header>

Expand Down Expand Up @@ -57,6 +54,7 @@ import {VoxxrinDetailedTalk} from "@/models/VoxxrinTalk";
import {VoxxrinConferenceDescriptor} from "@/models/VoxxrinConferenceDescriptor";
import {formatHourMinutes, weekDayMonthYearFormattedDate} from "@/models/DatesAndTime";
import {Temporal} from "temporal-polyfill";
import TalkRoom from "@/components/talk-card/TalkRoom.vue";
const props = defineProps({
talk: {
Expand Down
4 changes: 3 additions & 1 deletion mobile/src/models/VoxxrinSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export function getRoomsTalksSchedule(timeslots: VoxxrinScheduleTimeSlot[]) {
for(const timeslot of timeslots) {
if(timeslot.type === 'talks') {
for(const talk of timeslot.talks) {
perRoomIdTalks.set(talk.room.id.value, (perRoomIdTalks.get(talk.room.id.value) || []).concat({ talk, timeslot }))
if(talk.room) {
perRoomIdTalks.set(talk.room.id.value, (perRoomIdTalks.get(talk.room.id.value) || []).concat({ talk, timeslot }))
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/models/VoxxrinSpeaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export const createVoxxrinSpeakerFromFirestore = (conferenceDescriptor: VoxxrinC
const track = findTrack(conferenceDescriptor, new TrackId(firestoreTalk.track.id));
const allocation = match(firestoreTalk.allocation)
.with(P.not(P.nullish), allocation => {
const room = findRoom(conferenceDescriptor, new RoomId(allocation.room.id));
const maybeRoom = allocation.room ? findRoom(conferenceDescriptor, new RoomId(allocation.room.id)) : undefined;
return {
...allocation,
room
room: maybeRoom
};
}).otherwise(() => undefined);

Expand Down
20 changes: 15 additions & 5 deletions mobile/src/models/VoxxrinTalk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type VoxxrinTalk = Replace<Talk, {
speakers: VoxxrinSimpleSpeaker[],
format: VoxxrinTalkFormat,
track: VoxxrinTrack,
room: VoxxrinRoom,
room: VoxxrinRoom | undefined,
id: TalkId,
language: TalkLanguageCode
}>
Expand All @@ -43,15 +43,15 @@ export function removeTalkOverflowsAndDuplicates(talks: VoxxrinTalk[]) {
export function createVoxxrinTalkFromFirestore(event: VoxxrinConferenceDescriptor, firestoreTalk: Talk) {
const format = findTalkFormat(event, new TalkFormatId(firestoreTalk.format.id));
const track = findTrack(event, new TrackId(firestoreTalk.track.id));
const room = findRoom(event, new RoomId(firestoreTalk.room.id));
const maybeRoom = firestoreTalk.room ? findRoom(event, new RoomId(firestoreTalk.room.id)) : undefined;

const talk: VoxxrinTalk = {
language: new TalkLanguageCode(firestoreTalk.language),
title: firestoreTalk.title,
speakers: firestoreTalk.speakers.map(sp => toVoxxrinSpeaker(sp)),
format,
track,
room,
room: maybeRoom,
id: new TalkId(firestoreTalk.id),
isOverflow: firestoreTalk.isOverflow
}
Expand Down Expand Up @@ -93,7 +93,17 @@ export function sortThenGroupByFormat(talks: VoxxrinTalk[], confDescriptor: Voxx
talksPerFormat.forEach(format => {
// Ensuring all talks for a given format are always sorted by rooms declaration order
// in conf descriptor
format.talks = sortBy(format.talks, talk => confDescriptor.rooms.findIndex(room => room.id.isSameThan(talk.room.id)))
format.talks = sortBy(
format.talks,
talk => {
const talkRoom = talk.room;
if(!talkRoom) {
return 1000; // should be enough to put unallocated talks to room in the end of the list :-)
}

return confDescriptor.rooms.findIndex(room => room.id.isSameThan(talkRoom.id))
}
)
})

return talksPerFormat
Expand All @@ -108,7 +118,7 @@ export function filterTalksMatching(talks: VoxxrinTalk[], searchTerms: string|un
const talkSearchableContent = `
${talk.title}
${talk.speakers.map(sp => `${sp.fullName} ${sp.companyName}`).join("\n")}
${talk.room.title}
${talk.room?.title || ""}
`.toLowerCase()

return searchTerms.split(" ").every(searchTerm => talkSearchableContent.includes(searchTerm.toLowerCase()));
Expand Down
3 changes: 2 additions & 1 deletion mobile/src/views/SpeakerDetailsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<div class="sectionBloc" v-if="speaker.talks.length > 0">
<VoxDivider>{{LL.Speaker_talks()}}</VoxDivider>
<talk-card v-for="talk in speaker.talks" :key="talk.id.value" scope="speaker"
:talk="{ ...talk, speakers: [speaker, ...talk.otherSpeakers] }" :room-id="talk.allocation?.room.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)"
:talk="{ ...talk, speakers: [speaker, ...talk.otherSpeakers] }"
:room-id="talk.allocation?.room?.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)"
:talk-notes="userEventTalkNotesRef.get(talk.id.value)"
@talk-clicked="(clickedTalk) => $emit('talk-clicked', clickedTalk)"
:is-highlighted="(talk, talkNotes) => talkNotes.isFavorite" :conf-descriptor="confDescriptor">
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/views/TalkDetailsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ion-header>

<talk-details-header :conf-descriptor="confDescriptor" :talk="detailedTalkRef">
<room-capacity-indicator v-if="!!firestoreRoomStatsRef && detailedTalkRef.room.id" :spaced-event-id="spacedEventIdRef" :talkId="detailedTalkRef.id" :room-id="detailedTalkRef.room.id" :room-stats="firestoreRoomStatsRef" :bottom-rounded="true" :show-unknown-capacity="false" />
<room-capacity-indicator v-if="!!firestoreRoomStatsRef && detailedTalkRef.room?.id" :spaced-event-id="spacedEventIdRef" :talkId="detailedTalkRef.id" :room-id="detailedTalkRef.room.id" :room-stats="firestoreRoomStatsRef" :bottom-rounded="true" :show-unknown-capacity="false" />
</talk-details-header>

<div class="talkDetails-tags" v-if="detailedTalkRef?.tags.length">
Expand Down Expand Up @@ -166,7 +166,7 @@ const theme = computed(() => {
}
});
const {firestoreRoomStatsRef } = useRoomStats(spacedEventIdRef, toRef(() => detailedTalkRef.value?.room.id))
const {firestoreRoomStatsRef } = useRoomStats(spacedEventIdRef, toRef(() => detailedTalkRef.value?.room?.id))
</script>

Expand Down
2 changes: 1 addition & 1 deletion mobile/src/views/event/FeedbacksPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ion-item>
<ion-item v-else-if="feedback.status === 'provided'" class="listTalks-item">
<talk-card :talk="findTimeslotTalkMatchingFeedback(timeslot, feedback.userFeedback)!" scope="rating"
:room-id="findTimeslotTalkMatchingFeedback(timeslot, feedback.userFeedback)!.room.id"
:room-id="findTimeslotTalkMatchingFeedback(timeslot, feedback.userFeedback)!.room?.id"
:talk-notes="userEventTalkNotesRef.get(findTimeslotTalkMatchingFeedback(timeslot, feedback.userFeedback)!.id.value)"
:is-highlighted="(talk, talkNotes) => talkNotes.isFavorite"
:conf-descriptor="confDescriptor"
Expand Down
3 changes: 2 additions & 1 deletion mobile/src/views/event/SpeakersDirectoryPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<ion-list class="talkResumeList"
:style="{ display: currentMode === 'detailed' ? 'block':'none' }">
<talk-card v-for="talk in speaker.talks" :key="talk.id.value"
:talk="{ ...talk, speakers: [speaker, ...talk.otherSpeakers] }" :room-id="talk.allocation?.room.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)"
:talk="{ ...talk, speakers: [speaker, ...talk.otherSpeakers] }"
:room-id="talk.allocation?.room?.id" :talk-stats="talkStatsRefByTalkId.get(talk.id.value)"
:talk-notes="userEventTalkNotesRef.get(talk.id.value)"
@talk-clicked="(clickedTalk) => $emit('talk-clicked', clickedTalk)"
:is-highlighted="(talk, talkNotes) => talkNotes.isFavorite" :conf-descriptor="confDescriptor" scope="speaker">
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/views/feedbacks/RateTalkPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="rateTalkView">
<div class="rateTalkView-head">
<talk-card :conf-descriptor="confDescriptorRef" :is-highlighted="() => false" scope="rating"
:talk="labelledTimeslotWithTalkRef.talk" :room-id="labelledTimeslotWithTalkRef.talk.room.id"
:talk="labelledTimeslotWithTalkRef.talk" :room-id="labelledTimeslotWithTalkRef.talk.room?.id"
:talk-notes="userEventTalkNotesRef.get(labelledTimeslotWithTalkRef.talk.id.value)">
</talk-card>
</div>
Expand Down
2 changes: 1 addition & 1 deletion shared/daily-schedule.firestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type Talk = {
id: string,
title: string,
track: Track,
room: Room,
room: Room|undefined,
isOverflow: boolean
}
export type DetailedTalk = Talk & {
Expand Down
2 changes: 1 addition & 1 deletion shared/event-lineup.firestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type LineupTalk = {
track: Track,
tags: string[],
allocation: {
room: Room,
room: Room|undefined,
start: ISODatetime,
end: ISODatetime,
}|undefined,
Expand Down

0 comments on commit 9528832

Please sign in to comment.