bugfix: time now

This commit is contained in:
Rob 2019-09-21 13:56:06 +02:00
parent 3616a18872
commit 45f6a926bc
2 changed files with 17 additions and 12 deletions

View File

@ -128,6 +128,7 @@
if (faketime != null) {
s.setTimeTo(new Date(faketime));
}
s.getEvents();
// output part of the schedule
$('.conf_version').html(s.getScheduleVersion());
@ -141,7 +142,6 @@
$('.talks_plan').append(event_view(event));
});
var eventObj = s.getEventsAllTracks(10);
console.log(eventObj);
eventObj.events.forEach(event => {
$('.talks_overview').append(event_view(event, true));
});

View File

@ -44,7 +44,6 @@ class Schedule {
this.conf.title = this.schedule.children("conference").children("title").text();
this.conf.start = this.schedule.children("conference").children("start").text();
this.conf.end = this.schedule.children("conference").children("end").text();
this.events = this.getEvents();
}
/**
@ -87,19 +86,25 @@ class Schedule {
let allEvents = [];
if (this.events.length == 0 ){
//this.schedule.find('event').toArray();
var now = this.now
this.schedule.find('event').each( function(){
allEvents.push({
title: $(this).children('title').text(),
room: $(this).children('room').text(),
date: $(this).children('date').text(),
start: $(this).children('start').text(),
duration: $(this).children('duration').text(),
abstract: $(this).children('abstract').text().slice(0, 256),
persons: $(this).children('persons').text(),
});
var eventStart = new Date($(this).children('date').text());
if ((eventStart - now) >= 0){
allEvents.push({
title: $(this).children('title').text(),
room: $(this).children('room').text(),
date: $(this).children('date').text(),
start: $(this).children('start').text(),
duration: $(this).children('duration').text(),
abstract: $(this).children('abstract').text().slice(0, 256),
persons: $(this).children('persons').text(),
});
}
});
}
return allEvents;
this.events = allEvents;
console.log('DDDD', allEvents.length);
}
getEventsAllTracks(count)