Commit c67bc4b1 authored by Gijs Hendriksen's avatar Gijs Hendriksen Committed by Nienke
Browse files

Welcome screen now displays correctly when there are only two or fewer events.

Previously, the welcome screen didn't show any events if there were only two or fewer events on the server.
parent dbffe0bb
...@@ -29,16 +29,12 @@ const eventListToSections = (eventList) => { ...@@ -29,16 +29,12 @@ const eventListToSections = (eventList) => {
for (let i = 0; i < numberOfDays && eventIndex < eventList.length; i += 1) { for (let i = 0; i < numberOfDays && eventIndex < eventList.length; i += 1) {
const first = eventList[eventIndex]; const first = eventList[eventIndex];
eventIndex += 1;
const list = []; const list = [];
let next = first; while (eventIndex < eventList.length && Moment(first.start).isSame(eventList[eventIndex].start, 'day')) {
while (Moment(first.start).isSame(next.start, 'day') && eventIndex < eventList.length) { list.push(eventList[eventIndex]);
list.push(next);
next = eventList[eventIndex];
eventIndex += 1; eventIndex += 1;
} }
eventLists.push(list); eventLists.push(list);
eventIndex -= 1;
} }
return eventLists.map(list => ({ return eventLists.map(list => ({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment