Skip to content

Commit

Permalink
try to solve (Try: 005)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmielchen committed Mar 12, 2023
1 parent 40a8fcc commit 3fb4f55
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /app
RUN mvn clean package

FROM amazoncorretto:17-alpine
ENV OFFSET="Z"
ENV TIMEZONE="Europe/Berlin"
ENV ROOM="Room"
ENV TEACHER="Teacher"
ENV SUMMARY="School"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.velocitypackage.untiscalendar.app

object Config
{
var offset : String = System.getenv("OFFSET")
var timezone : String = System.getenv("TIMEZONE")
var defaultRoomAlias : String = System.getenv("ROOM")
var defaultTeacherAlias : String = System.getenv("TEACHER")
var defaultSummary : String = System.getenv("SUMMARY")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fun Timetable.getCalender() : Calendar
calendar.properties.add(ProdId("-//VelocityPackage//UntisCalender 1.0//EN"))
calendar.properties.add(Version.VERSION_2_0)
calendar.properties.add(CalScale.GREGORIAN)
calendar.components.add(TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(Config.timezone).vTimeZone)
for (lesson in this)
{
if (lesson.code == UntisUtils.LessonCode.CANCELLED) continue
Expand All @@ -29,12 +30,8 @@ fun Timetable.getCalender() : Calendar
name = lesson.subjects.longNames[0]
} catch (_ : Exception) { }
val event = VEvent(
DateTime(
lesson.startTime.atDate(lesson.date).toInstant(ZoneOffset.of(Config.offset)).toEpochMilli()
),
DateTime(
lesson.endTime.atDate(lesson.date).toInstant(ZoneOffset.of(Config.offset)).toEpochMilli()
),
Date(Date.from(lesson.startTime.atDate(lesson.date).atZone(ZoneId.of(Config.timezone)).toInstant())),
Date(Date.from(lesson.endTime.atDate(lesson.date).atZone(ZoneId.of(Config.timezone)).toInstant())),
name
)
try
Expand Down

0 comments on commit 3fb4f55

Please sign in to comment.