diff --git a/timetable/static/bundled/timetable/generator-index.ts b/timetable/static/bundled/timetable/generator-index.ts index 2becbe7e..241b75af 100644 --- a/timetable/static/bundled/timetable/generator-index.ts +++ b/timetable/static/bundled/timetable/generator-index.ts @@ -2,7 +2,7 @@ import html2canvas from "html2canvas"; // see https://regex101.com/r/QHSaPM/2 const TIMETABLE_ROW_RE: RegExp = - /^(?[A-Z\d]{4}(?:\+[A-Z\d]{4})?)\s+(?[A-Z]{2}\d)\s+((?[AB])\s+)?(?(lundi)|(mardi)|(mercredi)|(jeudi)|(vendredi)|(samedi)|(dimanche))\s+(?\d{2}:\d{2})\s+(?\d{2}:\d{2})\s+[\dA-B]\s+(?:[\wé]*\s+)?(?\w+(?:, \w+)?)$/; + /^(?\w.+\w)\s+(?[A-Z]{2}\d)\s+((?[AB])\s+)?(?(lundi)|(mardi)|(mercredi)|(jeudi)|(vendredi)|(samedi)|(dimanche))\s+(?\d{2}:\d{2})\s+(?\d{2}:\d{2})\s+[\dA-B]\s+((?[\wé]*)\s+)?(?\w+(?:, \w+)?)$/; const DEFAULT_TIMETABLE: string = `DS52\t\tCM1\t\tlundi\t08:00\t10:00\t1\tPrésentiel\tA113 DS53\t\tCM1\t\tlundi\t10:15\t12:15\t1\tPrésentiel\tA101 @@ -138,11 +138,14 @@ document.addEventListener("alpine:init", () => { }, getStyle(slot: TimetableSlot) { + const hasWeekGroup = slot.weekGroup !== undefined; + const width = hasWeekGroup ? SLOT_WIDTH / 2 : SLOT_WIDTH; + const leftOffset = slot.weekGroup === "B" ? SLOT_WIDTH / 2 : 0; return { height: `${(slot.endSlot - slot.startSlot) * SLOT_HEIGHT}px`, - width: `${SLOT_WIDTH}px`, + width: `${width}px`, top: `${(slot.startSlot - this.startSlot) * SLOT_HEIGHT}px`, - left: `${this.displayedWeekdays.indexOf(slot.weekday) * SLOT_WIDTH}px`, + left: `${this.displayedWeekdays.indexOf(slot.weekday) * SLOT_WIDTH + leftOffset}px`, backgroundColor: this.colors[slot.ueCode], }; }, diff --git a/timetable/templates/timetable/generator.jinja b/timetable/templates/timetable/generator.jinja index 66dfb614..0a5fe9ce 100644 --- a/timetable/templates/timetable/generator.jinja +++ b/timetable/templates/timetable/generator.jinja @@ -40,6 +40,7 @@
+