Skip to content

Commit

Permalink
Add ability to sort auditoria into subspaces by track type
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Dec 27, 2024
1 parent dd48e31 commit db800a6
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ conference:
# alias: stands
# # The prefixes of rooms which belong in the subspace
# prefixes: ["S."]
# # The types of tracks which belong in the subspace
# trackTypes: ["stands"]

# Options related to the IRC bridge. Set to null if you don't use an IRC bridge.
ircBridge: null
Expand Down
28 changes: 24 additions & 4 deletions src/Conference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,19 @@ export class Conference {

/**
* Determines the space in which an auditorium space or interest room should reside.
*
* For both auditoria and interest rooms, this is based off a set of configured prefixes for the
* auditorium or interest room ID.
*
* For auditoria, there is the additional option to match on the track type (with a set of configured
* mappings).
*
* ## Historical notes
*
* Matching on track types was added for FOSDEM 2025. Previously, only prefixes were available
* as a matching mechanism but the track type support was needed once auditoria were changed to
* represent tracks instead of being 1:1 mapped to physical in-person rooms.
*
* @param auditoriumOrInterestRoom The description of the auditorium or interest room.
* @returns The space in which the auditorium or interest room should reside.
*/
Expand All @@ -686,12 +699,19 @@ export class Conference {
const id = auditoriumOrInterestRoom.id;

for (const [subspaceId, subspaceConfig] of Object.entries(this.config.conference.subspaces)) {
for (const prefix of subspaceConfig.prefixes) {
if (id.startsWith(prefix)) {
if (!(subspaceId in this.subspaces)) {
throw new Error(`The ${subspaceId} subspace has not been created yet!`);
if (subspaceConfig.prefixes !== undefined) {
for (const prefix of subspaceConfig.prefixes) {
if (id.startsWith(prefix)) {
if (!(subspaceId in this.subspaces)) {
throw new Error(`The ${subspaceId} subspace has not been created yet!`);
}
return this.subspaces[subspaceId];
}
}
}

if (subspaceConfig.trackTypes !== undefined && 'trackType' in auditoriumOrInterestRoom) {
if (subspaceConfig.trackTypes.includes(auditoriumOrInterestRoom.trackType)) {
return this.subspaces[subspaceId];
}
}
Expand Down
1 change: 1 addition & 0 deletions src/backends/json/FosdemJsonScheduleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class FosdemJsonScheduleLoader {
talks: new Map(),
// Hardcoded: FOSDEM is always physical now.
isPhysical: true,
trackType: track.type,
};
}
}
1 change: 1 addition & 0 deletions src/backends/json/JsonScheduleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class JsonScheduleLoader {
talks,
// TODO Support physical auditoriums in the JSON schedule backend
isPhysical: false,
trackType: '',
};
}
}
3 changes: 2 additions & 1 deletion src/backends/penta/PentabarfParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ export class PentabarfParser {
name: metadata.name,
kind: metadata.kind,
talks: new Map(),
isPhysical: isPhysical
isPhysical: isPhysical,
trackType: '',
};
const existingAuditorium = this.auditoriums.find(r => r.id === auditorium.id);
if (existingAuditorium) {
Expand Down
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export interface IConfig {
[name: string]: {
displayName: string;
alias: string;
prefixes: string[];
prefixes?: string[];
trackTypes?: string[];
};
};
};
Expand Down
7 changes: 7 additions & 0 deletions src/models/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ export interface IAuditorium {
* If true, this auditorium is just a virtual representation of a real-world physical auditorium.
*/
isPhysical: boolean;

/**
* A 'type' of track that this auditorium is in.
* May be an empty string if there is no concept of types.
* This string will not be human-readable.
*/
trackType: string;
}

export interface IConference {
Expand Down

0 comments on commit db800a6

Please sign in to comment.