mirror of
https://github.com/ae-utbm/sith.git
synced 2025-09-13 11:35:44 +00:00
update regex
This commit is contained in:
committed by
imperosol
parent
ddb1f7270a
commit
05b55bc540
@@ -2,7 +2,7 @@ import html2canvas from "html2canvas";
|
||||
|
||||
// see https://regex101.com/r/QHSaPM/2
|
||||
const TIMETABLE_ROW_RE: RegExp =
|
||||
/^(?<ueCode>[A-Z\d]{4}(?:\+[A-Z\d]{4})?)\s+(?<courseType>[A-Z]{2}\d)\s+((?<weekGroup>[AB])\s+)?(?<weekday>(lundi)|(mardi)|(mercredi)|(jeudi)|(vendredi)|(samedi)|(dimanche))\s+(?<startHour>\d{2}:\d{2})\s+(?<endHour>\d{2}:\d{2})\s+[\dA-B]\s+(?:[\wé]*\s+)?(?<room>\w+(?:, \w+)?)$/;
|
||||
/^(?<ueCode>\w.+\w)\s+(?<courseType>[A-Z]{2}\d)\s+((?<weekGroup>[AB])\s+)?(?<weekday>(lundi)|(mardi)|(mercredi)|(jeudi)|(vendredi)|(samedi)|(dimanche))\s+(?<startHour>\d{2}:\d{2})\s+(?<endHour>\d{2}:\d{2})\s+[\dA-B]\s+((?<attendance>[\wé]*)\s+)?(?<room>\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],
|
||||
};
|
||||
},
|
||||
|
@@ -40,6 +40,7 @@
|
||||
<div class="slot" :style="getStyle(course)">
|
||||
<span x-text="`${course.ueCode} (${course.courseType})`"></span>
|
||||
<span x-text="`${course.startHour} - ${course.endHour}`"></span>
|
||||
<span x-text="(course.weekGroup ? `\nGroupe ${course.weekGroup}` : '')"></span>
|
||||
<span x-text="course.room"></span>
|
||||
</div>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user