From e6ba2e0334d84583caa7e6745d754bad68c0af76 Mon Sep 17 00:00:00 2001
From: kilyabin <65072190+kilyabin@users.noreply.github.com>
Date: Mon, 2 Mar 2026 14:43:16 +0400
Subject: [PATCH] =?UTF-8?q?feat(parser):=20parse=20"=D0=97=D0=B0=D0=B4?=
=?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=8B?=
=?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F"=20column"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now schedule can show the data in column "Задание для выполнения" under "Материалы" button
---
src/app/parser/schedule.ts | 47 +++++++++++++++++------
src/widgets/schedule/lesson.tsx | 10 +++--
src/widgets/schedule/resources-dialog.tsx | 8 +++-
3 files changed, 49 insertions(+), 16 deletions(-)
diff --git a/src/app/parser/schedule.ts b/src/app/parser/schedule.ts
index b2668c7..709cc24 100644
--- a/src/app/parser/schedule.ts
+++ b/src/app/parser/schedule.ts
@@ -991,20 +991,43 @@ const parseLesson = (row: Element, isTeacherSchedule: boolean = false): Lesson |
lesson.topic = cells[4].textContent?.trim() || ''
}
+ // Колонка "Ресурс"
lesson.resources = []
if (cells[5]) {
- Array.from(cells[5].querySelectorAll('a'))
- .forEach(a => {
- const title = a.textContent?.trim()
- const url = a.getAttribute('href')
- if (title && url) {
- lesson.resources.push({
- type: 'link',
- title,
- url
- })
- }
- })
+ Array.from(cells[5].querySelectorAll('a')).forEach(a => {
+ const title = a.textContent?.trim()
+ const url = a.getAttribute('href')
+ if (title && url) {
+ lesson.resources.push({
+ type: 'link',
+ title,
+ url,
+ })
+ }
+ })
+ }
+
+ // Колонка "Задание для выполнения"
+ lesson.homework = ''
+ if (cells[6]) {
+ const hwCell = cells[6]
+ const rawText = hwCell.textContent?.replace(/\s+/g, ' ').trim() || ''
+ if (rawText) {
+ lesson.homework = rawText
+ }
+
+ // Добавляем ссылки из задания тоже в список материалов
+ Array.from(hwCell.querySelectorAll('a')).forEach(a => {
+ const title = a.textContent?.trim()
+ const url = a.getAttribute('href')
+ if (title && url) {
+ lesson.resources.push({
+ type: 'link',
+ title,
+ url,
+ })
+ }
+ })
}
return lesson
diff --git a/src/widgets/schedule/lesson.tsx b/src/widgets/schedule/lesson.tsx
index bc6644c..e33092e 100644
--- a/src/widgets/schedule/lesson.tsx
+++ b/src/widgets/schedule/lesson.tsx
@@ -39,6 +39,9 @@ export function Lesson({ lesson, width = 350, animationDelay, hideTeacher = fals
const hasSubject = 'subject' in lesson && lesson.subject
const hasContent = hasSubject || (isFallbackDiscipline && lesson.fallbackDiscipline) || (lesson.topic && lesson.topic.trim())
const isCancelled = lesson.isChange && !hasContent
+ const hasHomework = Boolean(lesson.homework && lesson.homework.trim())
+ const hasResources = Boolean(lesson.resources.length)
+ const hasAnyMaterials = hasResources || hasHomework
const getTeacherPhoto = (url?: string) => {
if(url) {
@@ -134,7 +137,7 @@ export function Lesson({ lesson, width = 350, animationDelay, hideTeacher = fals
)}
- {!isCancelled && (Boolean(lesson.resources.length) || ('place' in lesson && lesson.place)) && (
+ {!isCancelled && (hasAnyMaterials || ('place' in lesson && lesson.place)) && (