feat: read "Занятия в Полоцке" as a day's town, show it in all clients
- Parser 14 (server/places.js): "Занятия в Полоцке/Новополоцке/г. Новополоцк" over a day's first row is no longer a lesson but a note of the day for its column (`places`); lessons of that day get `place`. A lesson below the note in the same cell keeps its own subject.
- A town on its own line ("Новополоцк", "г.Новополоцк") or after a room ("246(Новополоцк)") becomes the lesson's `place` and leaves the subject and room. "История Полоцка" is not a town.
- API 14: `place` on lessons and `places` on days of /api/timetable, `place` in the directory. The day notes are shared by the server and the PWA (shared/places.js); the same note in every subgroup reads as the whole group's.
- Android, PWA and iOS: a "Занятия в Полоцке" card above the day's lessons (day pages, calendar, overview, week view, desk stand), "Полоцк" under the date in the week grid, "249Ж · Полоцк" on lesson cards, a "Город" row in details, the town in widgets, tile, reminders and change lists.
- Snapshot lines show the town and the day notes; tests for notes, towns in cells and the API.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,16 +12,26 @@ export const lessonLine = (l) =>
|
||||
(l.variant === "upper" ? ", верхняя строка" : l.variant === "lower" ? ", нижняя строка" : ""),
|
||||
l.subject,
|
||||
l.type,
|
||||
l.room,
|
||||
// The town only when the cell names one or the day's note puts the lesson there.
|
||||
[l.room, l.place].filter(Boolean).join(", "),
|
||||
l.teacher,
|
||||
[...l.groups, ...l.subgroups.map((s) => `${s.group}/${s.label.replace("Подгруппа ", "п")}`)].join(","),
|
||||
]
|
||||
.map((part) => String(part ?? "").replace(/\s+/g, " ").trim())
|
||||
.join(" | ");
|
||||
|
||||
// "Занятия в Полоцке": a day of a group or subgroup in another town, not a lesson.
|
||||
const placeLine = (p) =>
|
||||
[
|
||||
`@ ${p.date || DAYS[p.day]}`,
|
||||
p.text,
|
||||
[...p.groups, ...p.subgroups.map((s) => `${s.group}/${s.label.replace("Подгруппа ", "п")}`)].join(","),
|
||||
].join(" | ");
|
||||
|
||||
/** Sorted lesson lines of a parsed document, with its groups and period on top. */
|
||||
export const snapshotOf = (schedule) => [
|
||||
`# ${schedule.period} · ${schedule.groups.join(", ")}`,
|
||||
...(schedule.places || []).map(placeLine).sort(),
|
||||
...schedule.lessons.map(lessonLine).sort(),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user