chuvsu-js 5.5.0 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -280,8 +280,9 @@ if (active?.id) {
280
280
  Webinar methods belong to `StudentPortalClient`; removed from `TimetableClient`.
281
281
  `id` is `null` when LK exposes no join button. `title` is the topic;
282
282
  `subject` is the discipline. Completed and not-yet-started rows remain in the list.
283
- `findWebinar` attaches only a unique match by actual date, time, subject,
284
- lesson type and known group/subgroup/teacher. `findWebinars` returns ambiguous
283
+ `findWebinar` attaches only a unique match by actual date, lesson slot (exact
284
+ time when a slot is unavailable), and known group/subgroup. Descriptive subject,
285
+ type and teacher labels do not block a match. `findWebinars` returns ambiguous
285
286
  candidates for manual selection. Missing dates never match. Join URLs are resolved
286
287
  on demand through LK; no webinar window opens automatically.
287
288
 
@@ -4,6 +4,6 @@ export type LessonWithWebinar = LessonOccurrence & {
4
4
  webinar?: Webinar;
5
5
  };
6
6
  export declare function findWebinar(lesson: LessonOccurrence, webinars: Webinar[]): Webinar | undefined;
7
- /** All compatible rows; callers can resolve ambiguity explicitly. */
7
+ /** Match scheduled date, slot (time when unavailable), and known group/subgroup. */
8
8
  export declare function findWebinars(lesson: LessonOccurrence, webinars: Webinar[]): Webinar[];
9
9
  export declare function attachWebinars(lessons: LessonOccurrence[], webinars: Webinar[]): LessonWithWebinar[];
@@ -1,4 +1,3 @@
1
- import { LessonType } from "../common/lesson-type.js";
2
1
  function normalize(value) {
3
2
  return value
4
3
  .toLocaleLowerCase("ru-RU")
@@ -10,7 +9,7 @@ export function findWebinar(lesson, webinars) {
10
9
  const matches = findWebinars(lesson, webinars);
11
10
  return matches.length === 1 ? matches[0] : undefined;
12
11
  }
13
- /** All compatible rows; callers can resolve ambiguity explicitly. */
12
+ /** Match scheduled date, slot (time when unavailable), and known group/subgroup. */
14
13
  export function findWebinars(lesson, webinars) {
15
14
  if (lesson.status === "cancelled")
16
15
  return [];
@@ -19,27 +18,24 @@ export function findWebinars(lesson, webinars) {
19
18
  return false;
20
19
  if (webinar.scheduledDate !== lesson.scheduledDate)
21
20
  return false;
22
- if (webinar.slotNumber != null &&
23
- webinar.slotNumber !== lesson.slotNumber) {
24
- return false;
21
+ if (webinar.slotNumber != null && lesson.slotNumber != null) {
22
+ if (webinar.slotNumber !== lesson.slotNumber)
23
+ return false;
25
24
  }
26
- if (!lesson.time ||
25
+ else if (!lesson.time ||
27
26
  webinar.time.start.hours !== lesson.time.start.hours ||
28
27
  webinar.time.start.minutes !== lesson.time.start.minutes ||
29
28
  webinar.time.end.hours !== lesson.time.end.hours ||
30
29
  webinar.time.end.minutes !== lesson.time.end.minutes) {
31
30
  return false;
32
31
  }
33
- if (normalize(webinar.subject) !== normalize(lesson.subject))
34
- return false;
35
- if (webinar.type !== LessonType.Unknown && lesson.type !== LessonType.Unknown && webinar.type !== lesson.type)
36
- return false;
37
32
  const groups = lesson.groups.values;
38
- if (groups.length && webinar.groups.length && !groups.some((attendance) => webinar.groups.some((group) => normalize(group) === normalize(attendance.group.name)) &&
39
- (webinar.subgroup == null || attendance.subgroup == null || webinar.subgroup === attendance.subgroup)))
33
+ const attendance = webinar.groups.length
34
+ ? groups.filter((entry) => webinar.groups.some((group) => normalize(group) === normalize(entry.group.name)))
35
+ : groups;
36
+ if (groups.length && !attendance.length)
40
37
  return false;
41
- const teachers = lesson.teachers.values.filter((teacher) => teacher.name.trim());
42
- if (teachers.length && webinar.teacher.name.trim() && !teachers.some((teacher) => normalize(teacher.name) === normalize(webinar.teacher.name)))
38
+ if (webinar.subgroup != null && attendance.length && !attendance.some((entry) => entry.subgroup == null || entry.subgroup === webinar.subgroup))
43
39
  return false;
44
40
  return true;
45
41
  });
@@ -72,10 +72,10 @@ in LK JavaScript and verified with mocked responses and live URL retrieval.
72
72
 
73
73
  `findWebinar(lesson, webinars)` returns a unique compatible row.
74
74
  `findWebinars` returns all candidates. Matching checks actual scheduled date,
75
- slot when known, exact time range, normalized discipline, type, and known
76
- group/subgroup/teacher data. Cancelled lessons never match. Name comparison
77
- normalizes case, whitespace and `ё`; it does not guess equivalence between
78
- full names and initials. Ambiguous rows require caller selection.
75
+ slot when both sides expose it, otherwise the exact time range, and known
76
+ group/subgroup data. Discipline, type and teacher labels do not affect matching;
77
+ LK and timetable can describe the same lesson differently. Cancelled lessons
78
+ never match. Ambiguous rows require caller selection.
79
79
  `attachWebinars` preserves lesson IDs and never changes repository records.
80
80
 
81
81
  ## Portfolio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chuvsu-js",
3
- "version": "5.5.0",
3
+ "version": "5.5.1",
4
4
  "description": "Библиотека для расписания и личного кабинета ЧГУ им. И. Н. Ульянова",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",