Skip to content

Commit

Permalink
Removed a bug for an empty calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Matthis committed Jun 27, 2024
1 parent e96aaa7 commit 6bd45ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ function parseCalendar(active){
// Do we want 'Startet/Endet in' or 'Startet/Endet um'?
let diff = 0;
let t = 0;

console.debug('Lenght ', calendar.length);
console.debug('Calendar ', calendar);

now = Date.now();
if (calendar.length > 0){
Expand All @@ -90,6 +90,7 @@ function parseCalendar(active){
console.debug('Diff ', diff, t, now);
} else {
console.debug('Calendar is empty');

}

hours = (diff > 0) ? Math.floor(diff / (1000 * 60 * 60)) : 0;
Expand All @@ -101,7 +102,8 @@ function parseCalendar(active){
seconds = (seconds < 10) ? '0' + seconds : seconds;

console.debug('Remaining ', diff/1000);
return calendar.length == 0 && !is_active ? 'Keine Aufzeichnung geplant' : active.info + ' ' + hours + ':' + minutes + ':' + seconds;
console.log(diff, calendar.length, is_active);
return (calendar.length == 0 && !is_active) ? 'Keine Aufzeichnung geplant' : active.info + ' ' + hours + ':' + minutes + ':' + seconds;
}

function updateCalendar() {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func setupRouter() *gin.Engine {
c.JSON(http.StatusOK, events)
} else {
fmt.Println("No Events")
c.JSON(http.StatusNoContent, "[]")
c.JSON(http.StatusOK, "")
}
})

Expand Down

0 comments on commit 6bd45ca

Please sign in to comment.