55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
interface LessonLike {
|
|
day: number;
|
|
date: string | null;
|
|
start: string;
|
|
end: string | null;
|
|
subject: string;
|
|
teacher: string;
|
|
room: string;
|
|
place?: string;
|
|
type: string;
|
|
condition: string;
|
|
variant: "all" | "upper" | "lower";
|
|
groups: string[];
|
|
subgroups: { group: string; label: string }[];
|
|
}
|
|
/** Rooms and teachers of a lesson for some weeks, by number or colour (parser's `plan`). */
|
|
export interface PlanEntry {
|
|
weeks: [number, number | null][] | null;
|
|
color: "white" | "green" | null;
|
|
rooms: string[];
|
|
teachers: string[];
|
|
}
|
|
export function planFor(plan: PlanEntry[] | null | undefined, week: { n: number | null; color: string } | null | undefined): PlanEntry[];
|
|
export interface FieldChange {
|
|
field: string;
|
|
label: string;
|
|
from: string | number;
|
|
to: string | number;
|
|
}
|
|
export interface ScheduleDiff<L> {
|
|
added: L[];
|
|
removed: L[];
|
|
changed: { before: L; after: L; fields: FieldChange[] }[];
|
|
}
|
|
export interface PersonalPrefs {
|
|
subgroup?: string | null;
|
|
hidden?: string[];
|
|
}
|
|
export function lessonKey(lesson: LessonLike, group: string): string;
|
|
export function diffSchedules<L extends LessonLike>(
|
|
before: { lessons: L[] } | null | undefined,
|
|
after: { lessons: L[] } | null | undefined,
|
|
group: string,
|
|
): ScheduleDiff<L>;
|
|
export function changeCount(diff: ScheduleDiff<unknown> | null | undefined): number;
|
|
export function personalFilter(
|
|
lesson: LessonLike,
|
|
group: string,
|
|
prefs: PersonalPrefs | null | undefined,
|
|
): "shown" | "hidden" | "other-subgroup";
|
|
export function subgroupsOf(
|
|
schedule: { lessons: LessonLike[] } | null | undefined,
|
|
group: string,
|
|
): string[];
|