From e39c38db3db9485cec2d76137fb3c770b35d45a2 Mon Sep 17 00:00:00 2001 From: David Ullmer Date: Sun, 27 Nov 2022 12:17:40 +0100 Subject: [PATCH] Add ignore list env variable --- env.EXAMPLE | 3 ++- src/main/kotlin/Main.kt | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/env.EXAMPLE b/env.EXAMPLE index b26034f..db1578d 100644 --- a/env.EXAMPLE +++ b/env.EXAMPLE @@ -4,4 +4,5 @@ CALDAV_USER=***dhbw-email*** DATE_END=***semester start date*** DATE_START=***semester end date*** RAPLA_KEY=***key in rapla url*** -RAPLA_URL=***Rapla URL like: https://rapla.dhbw-stuttgart.de/rapla*** \ No newline at end of file +RAPLA_URL=***Rapla URL like: https://rapla.dhbw-stuttgart.de/rapla*** +IGNORE_LIST=Klausurwoche;Wahl- und Zusatzfächer;... \ No newline at end of file diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index d562a39..41afb8f 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -13,6 +13,7 @@ fun main(args: Array) { var startDate = LocalDate.parse(System.getenv("DATE_START")) val endDate = LocalDate.parse(System.getenv("DATE_END")) val credentials = CalDavCredentials(System.getenv("CALDAV_URL"), System.getenv("CALDAV_USER"),System.getenv("CALDAV_PASSWORD")) + val ignoreList = System.getenv("IGNORE_LIST").split(';') val client = CalDavClient(credentials) // get all CalDav Lectures @@ -30,10 +31,10 @@ fun main(args: Array) { startDate = startDate.plusDays(7) } - // remove Klausurwoche Blockers - raplaLectures = ArrayList(raplaLectures.filter { lecture -> lecture.title != "Klausurwoche" }) - // remove Wahlfach - raplaLectures = ArrayList(raplaLectures.filter { lecture -> lecture.title != "Wahl- und Zusatzfächer" }) + // remove all Lectures in the ignore list + ignoreList.forEach { ignore -> + raplaLectures = ArrayList(raplaLectures.filter { lecture -> lecture.title != ignore }) + } // Nach Datum sortieren raplaLectures.sort()