Bugfixes
This commit is contained in:
parent
664f9c1777
commit
dfb07e96ce
|
@ -23,7 +23,7 @@ fun formatTime(unix: Long, timezone: Long) =
|
||||||
.withLocale(KlockLocale.german)
|
.withLocale(KlockLocale.german)
|
||||||
.format(DateTimeTz.utc(DateTime(unix), TimezoneOffset(timezone.toDouble())))
|
.format(DateTimeTz.utc(DateTime(unix), TimezoneOffset(timezone.toDouble())))
|
||||||
|
|
||||||
fun formatTimeDiff(time: Long, now: Long): String {
|
fun formatTimeDiff(time: Long, now: Long, timezone: Long): String {
|
||||||
var dt = (time - now) / 1000
|
var dt = (time - now) / 1000
|
||||||
|
|
||||||
val seconds = dt % 60
|
val seconds = dt % 60
|
||||||
|
@ -44,11 +44,11 @@ fun formatTimeDiff(time: Long, now: Long): String {
|
||||||
hours > 1L -> {
|
hours > 1L -> {
|
||||||
val nowHour = DateFormat("HH")
|
val nowHour = DateFormat("HH")
|
||||||
.withLocale(KlockLocale.german)
|
.withLocale(KlockLocale.german)
|
||||||
.format(now).toIntOrNull() ?: 0
|
.format(DateTimeTz.utc(DateTime(time), TimezoneOffset(timezone.toDouble()))).toIntOrNull() ?: 0
|
||||||
|
|
||||||
val ht = DateFormat("HH:mm")
|
val ht = DateFormat("HH:mm")
|
||||||
.withLocale(KlockLocale.german)
|
.withLocale(KlockLocale.german)
|
||||||
.format(time)
|
.format(DateTimeTz.utc(DateTime(time), TimezoneOffset(timezone.toDouble())))
|
||||||
|
|
||||||
if ((ht.substringBefore(":").toIntOrNull() ?: 0) < nowHour) {
|
if ((ht.substringBefore(":").toIntOrNull() ?: 0) < nowHour) {
|
||||||
"morgen"
|
"morgen"
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.kif.frontend.views.board
|
||||||
|
|
||||||
import de.kif.common.formatTimeDiff
|
import de.kif.common.formatTimeDiff
|
||||||
import de.kif.common.model.Schedule
|
import de.kif.common.model.Schedule
|
||||||
|
import de.kif.frontend.timezoneOffset
|
||||||
import de.kif.frontend.views.overview.getByClassOrCreate
|
import de.kif.frontend.views.overview.getByClassOrCreate
|
||||||
import de.westermann.kobserve.event.EventHandler
|
import de.westermann.kobserve.event.EventHandler
|
||||||
import de.westermann.kwebview.View
|
import de.westermann.kwebview.View
|
||||||
|
@ -35,8 +36,8 @@ class BoardSchedule(
|
||||||
|
|
||||||
fun updateTime(now: Long) {
|
fun updateTime(now: Long) {
|
||||||
timeView.textContent = when {
|
timeView.textContent = when {
|
||||||
startTime >= now -> "Start ${formatTimeDiff(startTime, now)}"
|
startTime >= now -> "Start ${formatTimeDiff(startTime, now, timezoneOffset)}"
|
||||||
endTime >= now -> "Ende ${formatTimeDiff(endTime, now)}"
|
endTime >= now -> "Ende ${formatTimeDiff(endTime, now, timezoneOffset)}"
|
||||||
else -> {
|
else -> {
|
||||||
onRemove.emit(Unit)
|
onRemove.emit(Unit)
|
||||||
"---"
|
"---"
|
||||||
|
|
|
@ -196,7 +196,7 @@
|
||||||
|
|
||||||
.calendar-row {
|
.calendar-row {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
height: 0.7rem !important;
|
height: 0.6rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-cell {
|
.calendar-cell {
|
||||||
|
@ -210,6 +210,27 @@
|
||||||
.calendar-entry::after {
|
.calendar-entry::after {
|
||||||
content: none;
|
content: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.calendar-header {
|
||||||
|
.calendar-cell {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
span {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-body {
|
||||||
|
.calendar-entry-name {
|
||||||
|
line-height: 1.2rem;
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.board-header-date {
|
.board-header-date {
|
||||||
|
|
|
@ -134,9 +134,9 @@ fun Route.board() {
|
||||||
attributes["data-end-time"] = endTime.toString()
|
attributes["data-end-time"] = endTime.toString()
|
||||||
|
|
||||||
if (startTime >= nowLocale) {
|
if (startTime >= nowLocale) {
|
||||||
+"Start ${formatTimeDiff(startTime, nowLocale)}"
|
+"Start ${formatTimeDiff(startTime, nowLocale, Configuration.Schedule.offset)}"
|
||||||
} else {
|
} else {
|
||||||
+"Ende ${formatTimeDiff(endTime, nowLocale)}"
|
+"Ende ${formatTimeDiff(endTime, nowLocale, Configuration.Schedule.offset)}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ private fun DIV.calendarEntry(schedule: Schedule, diff: Int, currentTime: Int) {
|
||||||
val finished = (diff < 0 || diff == 0 && schedule.time + schedule.workGroup.length < currentTime)
|
val finished = (diff < 0 || diff == 0 && schedule.time + schedule.workGroup.length < currentTime)
|
||||||
attributes["data-finished"] = finished.toString()
|
attributes["data-finished"] = finished.toString()
|
||||||
|
|
||||||
|
title = schedule.workGroup.name
|
||||||
|
|
||||||
span("calendar-entry-name") {
|
span("calendar-entry-name") {
|
||||||
+schedule.workGroup.name
|
+schedule.workGroup.name
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue