Compare commits

..

No commits in common. "ab9e5f6d19511635d3a9f3a00c0bbe67fa429687" and "bdd53ca15bc0fc3e042fb37a384476872cd7fa52" have entirely different histories.

5 changed files with 3 additions and 45 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "journal.pl", "name": "journal.pl",
"version": "3.6.3", "version": "3.6.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "journal.pl", "name": "journal.pl",
"version": "3.6.3", "version": "3.6.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@brojs/cli": "^0.0.4-beta.0", "@brojs/cli": "^0.0.4-beta.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "journal.pl", "name": "journal.pl",
"version": "3.6.3", "version": "3.6.2",
"description": "bro-js platform journal ui repo", "description": "bro-js platform journal ui repo",
"main": "./src/index.tsx", "main": "./src/index.tsx",
"scripts": { "scripts": {

View File

@ -53,17 +53,10 @@ export interface Lesson {
id: string; id: string;
name: string; name: string;
students: User[]; students: User[];
teachers: Teacher[];
date: string; date: string;
created: string; created: string;
} }
interface Teacher {
sub: string;
email_verified: boolean;
preferred_username: string;
}
export interface AccessCode { export interface AccessCode {
expires: string; expires: string;
lesson: Lesson; lesson: Lesson;

View File

@ -21,15 +21,8 @@ export const Attendance = () => {
if (!attendance) return null if (!attendance) return null
const studentsMap = new Map() const studentsMap = new Map()
const teachersMap = new Map()
attendance.forEach((lesson) => { attendance.forEach((lesson) => {
lesson.teachers?.map((teacher: any) => {
teachersMap.set(teacher.sub, { id: teacher.sub, ...teacher, value: teacher.value || (teacher.family_name && teacher.given_name
? `${teacher.family_name} ${teacher.given_name}`
: teacher.name || teacher.email || teacher.preferred_username || teacher.family_name || teacher.given_name), })
})
lesson.students.forEach((student) => { lesson.students.forEach((student) => {
const current = studentsMap.get(student.sub) || {} const current = studentsMap.get(student.sub) || {}
@ -46,13 +39,11 @@ export const Attendance = () => {
const compare = Intl.Collator('ru').compare const compare = Intl.Collator('ru').compare
const students = [...studentsMap.values()] const students = [...studentsMap.values()]
const taechers = [...teachersMap.values()]
students.sort(({ family_name: name }, { family_name: nname }) => students.sort(({ family_name: name }, { family_name: nname }) =>
compare(name, nname), compare(name, nname),
) )
return { return {
students, students,
taechers,
} }
}, [attendance]) }, [attendance])
@ -69,9 +60,6 @@ export const Attendance = () => {
<table> <table>
<thead> <thead>
<tr> <tr>
{data.taechers.map(teacher => (
<th id={teacher.id} key={teacher.id}>{teacher.value}</th>
))}
<th>Дата</th> <th>Дата</th>
<th>Название занятия</th> <th>Название занятия</th>
{data.students.map((student) => ( {data.students.map((student) => (
@ -82,22 +70,6 @@ export const Attendance = () => {
<tbody> <tbody>
{attendance.map((lesson, index) => ( {attendance.map((lesson, index) => (
<tr key={lesson.name}> <tr key={lesson.name}>
{data?.taechers?.map((teacher) => {
const wasThere = Boolean(lesson.teachers) &&
lesson?.teachers?.findIndex((u) => u.sub === teacher.sub) !== -1
return (
<td
style={{
textAlign: 'center',
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
}}
key={teacher.sub}
>
{wasThere ? '+' : '-'}
</td>
)
})}
<td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td> <td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td>
<td>{<ShortText text={lesson.name} />}</td> <td>{<ShortText text={lesson.name} />}</td>

View File

@ -4,13 +4,6 @@
{ {
"_id": "65e2e5fbec37fec650f28489", "_id": "65e2e5fbec37fec650f28489",
"name": "ВВЕДЕНИЕ В ВЕБ-РАЗРАБОТКУ. ИНСТРУМЕНТАРИЙ, ОБЗОР ВЕБ-ТЕХНОЛОГИЙ", "name": "ВВЕДЕНИЕ В ВЕБ-РАЗРАБОТКУ. ИНСТРУМЕНТАРИЙ, ОБЗОР ВЕБ-ТЕХНОЛОГИЙ",
"teachers": [
{
"sub": "f62905b1-e223-40ca-910f-c8d84c6137c1",
"email_verified": true,
"preferred_username": "primakov"
}
],
"students": [ "students": [
{ {
"sub": "fcde3f22-d9ba-412a-a572-c59e515a290f", "sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",