From d9d2aaed11ec2dfdd7db892caa62769d42e0d8d5 Mon Sep 17 00:00:00 2001 From: Francesco Minnocci Date: Sun, 4 Feb 2024 16:35:20 +0100 Subject: [PATCH] chore: fix LIMCO courses' names --- src/main.jsx | 13 ++++++++----- src/utils.jsx | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.jsx b/src/main.jsx index 3cbde47..59a7a83 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -50,15 +50,18 @@ const TIMETABLE_IDS = { // } function specialEventPatches(eventi) { - // Il laboratorio del primo anno in realtà è in due canali separati - let i = 1 + // Il laboratorio del primo anno in realtà è in due gruppi separati eventi.forEach(evento => { if ( evento.nome === 'LABORATORIO DI INTRODUZIONE ALLA MATEMATICA COMPUTAZIONALE' ) { - evento.nome += ` (${i})` - i++ + if (evento.docenti[0].nome === 'GIOVANNI') { + evento.nome += ' (A)' + } + if (evento.docenti[0].nome === 'PAOLO') { + evento.nome += ' (B)' + } } }) @@ -131,7 +134,7 @@ async function loadCalendari(date) { const timetablesRaw = results.map(timetable => specialEventPatches(_.uniqBy(timetable, 'id')) ) - const allRaw = specialEventPatches(_.uniqBy(_.concat(...results), 'id')) + const allRaw = specialEventPatches(_.concat(...results), 'id') return { 'anno-1': formatEvents(timetablesRaw[0]), diff --git a/src/utils.jsx b/src/utils.jsx index 925719b..f429e67 100644 --- a/src/utils.jsx +++ b/src/utils.jsx @@ -61,6 +61,7 @@ export function prettyCourseName(name) { .replaceAll('IIi', 'III') .replaceAll('Iii', 'III') .replaceAll(/'(.)/g, ({}, letter) => "'" + letter.toUpperCase()) + .replaceAll(/\((a|b)\)/g, ({}, letter) => "(" + letter.toUpperCase() + ")") } export function prettyAulaName(name) {