Read the statement by Michael Teeuw here.
2.32.0 Calendar module limitDays and excludedEvents stopped working
-
@AndyHazz would you be willing to test another implementation of the limitDays code fix
another author has changed the code quite a bit,
copy the existing calendar.js so not losing what you have
new codeif (this.config.limitDays > 0 && events.length>0) { // line 708 // Group all events by date, events on the same date will be in a list with the key being the date. Log.info("limitdays starting, events list length=", events.length) const eventsByDate = Object.groupBy(events, (ev) => this.timestampToMoment(ev.startDate).format("YYYY-MM-DD")); Log.info("eventsByDate keys=",Object.keys(eventsByDate)) const newEvents = []; let currentDate = moment().subtract(1,'days'); let daysCollected = 0; while (daysCollected < this.config.limitDays) { const dateStr = currentDate.format("YYYY-MM-DD"); Log.info("limitDays checking=",dateStr) // Check if there are events on the currentDate if (eventsByDate[dateStr]) Log.info("eventsByDate[",dateStr,"] length=",eventsByDate[dateStr].length) if (eventsByDate[dateStr] && eventsByDate[dateStr].length > 0) { // If there are any events today then get all those events and select the currently active events and the events that are starting later in the day. newEvents.push(...eventsByDate[dateStr].filter((ev) => this.timestampToMoment(ev.endDate).isAfter(moment()))); // Since we found a day with events, increase the daysCollected by 1 daysCollected++; Log.info("limitDays, found day with events, count=",daysCollected) } // Search for the next day currentDate.add(1, "day"); } Log.info("limitDays done") events = newEvents; }
this line is unchanged after replacing above code
Log.info(`slicing events total maxcount=${this.config.maximumEntries}`); // this line is unchanged
-
@sdetweil no problem, that new code seems to work fine for me.
However, I don’t seem to have a great setup for testing - after making the changes, I can load up MM in my remote/laptop browser and immediately see the changes working, but if I try and refresh the electron browser on the raspberry pi running my mirror (using MMM-Remote-Control), it seems to take ages, crash, and then reverts the code back to the docker image default 😮💨
I can see this in the docker container logs so I reckon it’s reverting any changes I make there?
[entrypoint 18:36:04.283] [INFO] copy default modules [entrypoint 18:36:04.918] [INFO] copy css files > magicmirror@2.32.0 start > node --run start:x11
-
@AndyHazz said in 2.32.0 Calendar module limitDays and excludedEvents stopped working:
I can see this in the docker container logs so I reckon it’s reverting any changes I make there?
yes it overrides the default modules but you can change this behavior
-
@karsten13 aha, good to know, although I already started and now finished setting up from scratch again 🙄 no docker this time … I kept it on a spare sd card though so may switch back.
@sdetweil new code for limitDays reapplied on a fresh install, still seems fine. Previous suggestions to fix the excludedEvents still not working though.
-
said in 2.32.0 Calendar module limitDays and excludedEvents stopped working:
Previous suggestions to fix the excludedEvents still not working though.
@sdetweil hold up - it’s all working now! I don’t think I changed anything else, just an extra refresh. So, all your fixes are good. Sorry that took a while to figure out, and if I’d read @karsten13’s docker instructions properly I think that docker module override feature was probably the cause of earlier confusion.
-
@AndyHazz thanks for the feedback and extra effort
-
@AndyHazz these fixes are in the next release Oct 1