try get student name even better

This commit is contained in:
Primakov Alexandr Alexandrovich 2024-12-12 11:44:35 +03:00
parent 0aebb87210
commit b8741472a7
3 changed files with 1910 additions and 599 deletions

View File

@ -24,12 +24,14 @@ export const Attendance = () => {
attendance.forEach((lesson) => { attendance.forEach((lesson) => {
lesson.students.forEach((student) => { lesson.students.forEach((student) => {
const current = studentsMap.get(student.sub) || {}
studentsMap.set(student.sub, { studentsMap.set(student.sub, {
...student, ...student,
value: id: student.sub,
student.family_name && student.given_name value: current || (student.family_name && student.given_name
? `${student.family_name} ${student.given_name}` ? `${student.family_name} ${student.given_name}`
: student.name || student.email || student.preferred_username || student.family_name || student.given_name, : student.name || student.email || student.preferred_username || student.family_name || student.given_name),
}) })
}) })
}) })
@ -60,7 +62,7 @@ export const Attendance = () => {
<th>Дата</th> <th>Дата</th>
<th>Название занятия</th> <th>Название занятия</th>
{data.students.map((student) => ( {data.students.map((student) => (
<th key={student.sub}>{student.name}</th> <th id={student.id || student.sub} key={student.sub}>{student.name}</th>
))} ))}
</tr> </tr>
</thead> </thead>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff