scripts/ds2011-resources: sort by start time
This commit is contained in:
parent
c95ce295be
commit
cd0ed33ade
|
@ -93,13 +93,20 @@ processEvent({ id: '0000',
|
||||||
var scheduleFile = fs.readFileSync('content/static/datenspuren/2011/fahrplan/schedule.de.xml');
|
var scheduleFile = fs.readFileSync('content/static/datenspuren/2011/fahrplan/schedule.de.xml');
|
||||||
var schedule = ltx.parse(scheduleFile);
|
var schedule = ltx.parse(scheduleFile);
|
||||||
schedule.getChildren('day').forEach(function(dayEl) {
|
schedule.getChildren('day').forEach(function(dayEl) {
|
||||||
|
var dayEvents = [];
|
||||||
dayEl.getChildren('room').forEach(function(roomEl) {
|
dayEl.getChildren('room').forEach(function(roomEl) {
|
||||||
roomEl.getChildren('event').forEach(function(eventEl) {
|
roomEl.getChildren('event').forEach(function(eventEl) {
|
||||||
processEvent({ id: eventEl.attrs.id,
|
dayEvents.push({ id: eventEl.attrs.id,
|
||||||
title: eventEl.getChildText('title'),
|
time: eventEl.getChildText('start'),
|
||||||
slug: eventEl.getChildText('slug')
|
title: eventEl.getChildText('title'),
|
||||||
});
|
slug: eventEl.getChildText('slug')
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
dayEvents = dayEvents.sort(function(e1, e2) {
|
||||||
|
return (e1.time < e2.time) ? -1 :
|
||||||
|
((e1.time > e2.time) ? 1 : 0);
|
||||||
|
});
|
||||||
|
dayEvents.forEach(processEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user