Add locations

This commit is contained in:
Tom Hubrecht 2022-07-26 02:32:26 +02:00
parent 433568751c
commit def6868588
3 changed files with 40 additions and 24 deletions

View file

@ -75,11 +75,13 @@
headerContent: 'Salle'
}
],
resources: Object.entries(ENSLocations).flatMap(([building, rooms]) => rooms.map(room => ({
resources: Object.entries(ENSLocations).flatMap(([building, rooms]) =>
rooms.map(room => ({
id: `${building}-${room}`,
building,
room
}))),
}))
),
height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true,
@ -97,7 +99,8 @@
eventSources: [],
themeSystem: 'bootstrap5',
nextDayThreshold: '05:00:00',
progressiveEventRendering: true
progressiveEventRendering: true,
expandRows: true
});
const flatten = d => {

View file

@ -1,4 +1,4 @@
import STATIC_LOCATIONS from './static-ens-locations.json';
import STATIC_LOCATIONS from './static-ens-locations.json'
// https://stackoverflow.com/a/35970186
function invertColor(hex) {
@ -94,7 +94,7 @@ const calendars = {
color: null,
initial: false
},
'Ekjb4kDqMMqwJXZF': {
Ekjb4kDqMMqwJXZF: {
cloud: clouds.ELEVES_ENS,
name: 'Rentrée des départements',
short_name: 'Dpt',
@ -106,20 +106,20 @@ const calendars = {
short_name: 'Conf',
color: null
},
'PnRXqeq4SsSC33FM': {
PnRXqeq4SsSC33FM: {
cloud: clouds.ELEVES_ENS,
name: 'Visites de bibliothèques',
short_name: 'Bibli',
initial: false,
color: null
},
'NWPtiEiz62LTtjo2': {
NWPtiEiz62LTtjo2: {
cloud: clouds.ELEVES_ENS,
name: 'Amphis de rentrée',
short_name: 'Prés. de rentrée',
color: null
},
'JiRt58aJXay9kfyk': {
JiRt58aJXay9kfyk: {
cloud: clouds.ELEVES_ENS,
name: 'Réunions de rentrée des Masters',
short_name: 'Masters',
@ -173,7 +173,7 @@ export const calendarTree = {
'Réunions de rentrée des Masters': {},
'Activités pour les étudiants internationaux': {}
},
'Divers': {}
Divers: {}
}
export function getSubCalendars(name, tree = calendarTree) {
@ -238,11 +238,13 @@ function findLocationId(location) {
// Strip '(Jourdan)'
// Relocate room number
const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) => rooms.includes(location));
const result = Object.entries(STATIC_LOCATIONS).find(([building, rooms]) =>
rooms.includes(location)
)
if (result === undefined) return undefined;
const [building, _] = result;
return `${building}-${location}`;
if (result === undefined) return undefined
const [building, _] = result
return `${building}-${location}`
}
function fcEventFromjCalEvent(cal) {
@ -264,7 +266,7 @@ function fcEventFromjCalEvent(cal) {
fcEvent.location = evt.location || cal.default_location
if (fcEvent.location) {
fcEvent.resourceId = findLocationId(fcEvent.location);
fcEvent.resourceId = findLocationId(fcEvent.location)
}
if (evt.status) {

View file

@ -1,16 +1,27 @@
{ "45 rue d'Ulm":
[
{
"45 rue d'Ulm": [
"Amphithéâtre Galois",
"Bibliothèque Lettres",
"Salle Histoire",
"Salle Cavaillès",
"Salle Dussane",
"Salle des Actes",
"Cour aux Ernest",
"Salle Jaurès"
],
"29 rue d'Ulm": [
"Bibliothèque des sciences expérimentales"
"Salle des Résistants",
"Salle Cavaillès",
"Salle Cartan",
"Salle Noether",
"Salle Bourbaki",
"Cour aux Ernests",
"Cour du NIR",
"Cour Pasteur",
"Pôt",
"Petit pôt",
"Canopée",
"K-Fêt",
"Cave d'hackENS",
"Gymnase"
],
"29 rue d'Ulm": ["Bibliothèque des sciences expérimentales", "Salle Jaurès"],
"Jourdan": [
"Bibliothèque de Jourdan",
"Salle Marcel Roncayolo (R2-05)",