Skip to content

Commit

Permalink
feat: 🎸 includeClasses option
Browse files Browse the repository at this point in the history
  • Loading branch information
bddvlpr committed Jan 25, 2023
1 parent 43bec88 commit c528d0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const createCalendar = async (timetable: Lesson[], options: FormatOptions) => {
return createEvents([
...timetable
.filter((lesson) => {
if (options?.excludeClasses) {
if (options?.includeClasses) {
return lesson.su.some((su) =>
options.includeClasses?.includes(su.id)
);
} else if (options?.excludeClasses) {
return !lesson.su.some((su) =>
options.excludeClasses?.includes(su.id)
);
Expand Down
1 change: 1 addition & 0 deletions src/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import WebUntis, { Holiday, Lesson } from "webuntis";

interface FormatOptions {
offsetHours?: number;
includeClasses?: number[];
excludeClasses?: number[];
notifyBefore?: number;
}
Expand Down

0 comments on commit c528d0a

Please sign in to comment.