Fix: corsi con più aule, prof dei corsi, patch speciale per il lab di primo anno

This commit is contained in:
2022-09-14 23:51:28 +02:00
parent 96ca0fef8f
commit 7d20ccab10
7 changed files with 52 additions and 29 deletions
+11 -5
View File
@@ -2,7 +2,7 @@ import { format } from 'date-fns'
import _ from 'lodash'
import { useEffect, useRef, useState } from 'preact/hooks'
import { normalizeCourseName, WEEK_DAYS } from '../../utils.jsx'
import { prettyCourseName, WEEK_DAYS } from '../../utils.jsx'
export const Course = ({ events, selection, setSelection, hideOtherCourses }) => {
const selectionSet = new Set(selection)
@@ -11,6 +11,12 @@ export const Course = ({ events, selection, setSelection, hideOtherCourses }) =>
const eventsByCourse = _.groupBy(_.sortBy(visibleEvents, 'id'), 'id')
const profsPerCourse = _.mapValues(eventsByCourse, events =>
_.uniq(events.flatMap(event => event.docenti))
)
console.log(profsPerCourse)
const [currentlyHovered, setCurrentlyHovered] = useState(null)
const element = useRef()
@@ -51,14 +57,14 @@ export const Course = ({ events, selection, setSelection, hideOtherCourses }) =>
else setSelection(selection.filter(selId => selId !== id))
}}
>
<div class="title">{normalizeCourseName(courseEvents[0].name)}</div>
<div class="docenti">{courseEvents[0].docenti.join(', ')}</div>
<div class="title">{prettyCourseName(courseEvents[0].name)}</div>
<div class="docenti">{profsPerCourse[id].join(', ')}</div>
<div class="events">
{courseEvents.map(course => (
<div>
{WEEK_DAYS[course.start.getDay()]}{' '}
{format(course.start, 'H:mm')} &ndash;{' '}
{format(course.end, 'H:mm')} {course.aula}
{format(course.start, 'H:mm')}&ndash;
{format(course.end, 'H:mm')} {course.aule.join(', ')}
</div>
))}
</div>
+3 -3
View File
@@ -1,6 +1,6 @@
import { format } from 'date-fns'
import _ from 'lodash'
import { normalizeCourseName, WEEK_DAYS, withClasses } from '../../utils.jsx'
import { prettyCourseName, WEEK_DAYS, withClasses } from '../../utils.jsx'
export const Schedule = ({ events, selection, setSelection, hideOtherCourses }) => {
const selectionSet = new Set(selection)
@@ -37,12 +37,12 @@ export const Schedule = ({ events, selection, setSelection, hideOtherCourses })
)
}}
>
<div class="title">{normalizeCourseName(event.name)}</div>
<div class="title">{prettyCourseName(event.name)}</div>
<div class="orario">
{format(event.start, 'H:mm')} &ndash;{' '}
{format(event.end, 'H:mm')}
</div>
<div class="aula">{event.aula}</div>
<div class="aula">{event.aule.join(', ')}</div>
</div>
))}
</>
+3 -5
View File
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'preact/hooks'
import _ from 'lodash'
import { differenceInMinutes, startOfDay } from 'date-fns'
import { hashString, normalizeCourseName, WEEK_DAYS } from '../../utils.jsx'
import { hashString, prettyCourseName, WEEK_DAYS } from '../../utils.jsx'
import { layoutIntervals } from '../../interval-layout.js'
export const WorkWeek = ({ events, selection, setSelection, hideOtherCourses }) => {
@@ -126,10 +126,8 @@ export const WorkWeek = ({ events, selection, setSelection, hideOtherCourses })
)
}}
>
<div class="title">
{normalizeCourseName(event.data.name)}
</div>
<div class="aula">{event.data.aula}</div>
<div class="title">{prettyCourseName(event.data.name)}</div>
<div class="aula">{event.data.aule.join(', ')}</div>
</div>
))}
</>
+3 -3
View File
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'preact/hooks'
import _ from 'lodash'
import { differenceInMinutes, startOfDay } from 'date-fns'
import { normalizeCourseName } from '../../utils.jsx'
import { prettyCourseName } from '../../utils.jsx'
import { layoutIntervals } from '../../interval-layout.js'
export const WorkWeekGrid = ({ events, selection, setSelection, hideOtherCourses }) => {
@@ -197,7 +197,7 @@ export const WorkWeekGrid = ({ events, selection, setSelection, hideOtherCourses
colors[event.data.id][1]
})`}</div>
)}
{event.data.aula}
{event.data.aule.join(', ')}
</div>
))}
</>
@@ -217,7 +217,7 @@ export const WorkWeekGrid = ({ events, selection, setSelection, hideOtherCourses
>
{colors[course.id][1]}
</div>
<div class="name">{normalizeCourseName(course.name)}</div>
<div class="name">{prettyCourseName(course.name)}</div>
</>
))}
</div>
+2 -2
View File
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'preact/hooks'
import _ from 'lodash'
import { differenceInMinutes, startOfDay } from 'date-fns'
import { hashString, normalizeCourseName, WEEK_DAYS } from '../../utils.jsx'
import { hashString, prettyCourseName, WEEK_DAYS } from '../../utils.jsx'
import { layoutIntervals } from '../../interval-layout.js'
export const WorkWeekTranspose = ({ events }) => {
@@ -87,7 +87,7 @@ export const WorkWeekTranspose = ({ events }) => {
}}
ref={eventRef}
>
{normalizeCourseName(event.data.name)}
{prettyCourseName(event.data.name)}
</div>
)
}