Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Commit

Permalink
Add ignore list env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
daullmer committed Nov 27, 2022
1 parent 5ec69db commit e39c38d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion env.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -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***
RAPLA_URL=***Rapla URL like: https://rapla.dhbw-stuttgart.de/rapla***
IGNORE_LIST=Klausurwoche;Wahl- und Zusatzfächer;...
9 changes: 5 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fun main(args: Array<String>) {
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
Expand All @@ -30,10 +31,10 @@ fun main(args: Array<String>) {
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()
Expand Down

0 comments on commit e39c38d

Please sign in to comment.