MyBB Community Forums

Full Version: [Calendar] Event not shown in month view [R]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
A user reported this issue.

Steps to reproduce:
1. Set the start day of the week in the calendar's settings to monday
2. Add a new event on May 1st 2011.
3. The event is not shown in the month view.

Example:
Month view and week view
I can also reproduce this.
I can reproduce as well.
I notice on the calendar of my board (version 1.4.6) that if Sunday is not set as the start day of week some issues occur. The reported issue in the first post is only one of theese. There are a lot of events that are not shown in month view. Follow theese steps to easly find them.

1) Set the start day of the week in the calendar's settings to a day different from Sunday, e.g. Monday.
2) Create a daily recurring event from 01-01-2009 to 12-31-2013 so all days will have an event.
3) In the calendar month view go month by month and you will see that there are a lot of events not shown.

I also notice that in week view mode almost all mini calendars have this problem too. Moreover there are some mini calendars in which month doesn't start from 1. In my attachments you can see what I'm telling.

P.S. I have already fixed theese bugs in the code of my board and I will be very proud and happy to give my contribute sharing my solution for all. Smile
(2009-06-05, 10:08 AM)Gionet82 Wrote: [ -> ]I have already fixed theese bugs in the code of my board and I will be very proud and happy to give my contribute sharing my solution for all. Smile

If you could list the changes you've made, it would be appreciated. This one is actually doing my face in... Shy
Firstly I would explain what I have done and I hope to be as clear as possible. Rolleyes

The fact that not all events are shown is mainly concerned with the calculation of the timestamps passed to the function get_events. Except for the weekly overview this calculation is also involved in the searching of the first day we see in the calendar(or minicalendar too). Well, that piece of code seems to me rather confused so I decided to reorganize it so that was easier to understand what was wrong. Then I have rewritten some lines to fix the bug and now this code seems to me more readable and a bit shorter. I have tried all days as start day of week and now all seem to go well. Smile

Since the changes are spread in the two files calendar.php and function_calendar.php I think that attaching the whole files is the better thing. I marked with comments all the changes that I made. You can search "BUG 1" for the changes related to the specific issue of this topic.
In addition, in theese files there are three other small bugs that I found and fixed. You can find all modifications searching "GIONET82".
If there's anything I don't like, it's a calendar script.

I've tested out the various fixes and they seem pretty good to me. They all fix the issues mentioned and you've even hit ones not noticed before.

I'll test out some more, but I would appreciate it if some SQA guys took a look at it too.
I'll look into this. Trust me, changing one bit of code creates 3 more problems with the calendar script. I know firsthand since the release of MyBB 1.4 and all the maintenance releases
At the beginning, I'd tried to change only a few lines of code but then I realized that solving one problem soon created another one, just as Ryan says! That's why I decided to rewrite the whole flawed procedure rearranging the existing code. In the files attached to my previous post there are two big pieces of code marked by comments. If you see them you will notice that the resulting code now is more clear and readable. I've fully tested the script before posting it and I'm sure that if you will use this solution no side effect should happen in the future.Smile
(2009-06-05, 10:29 PM)Gionet82 Wrote: [ -> ]I've fully tested the script before posting it

Your definition of fully testing it is probably under one set of constant conditions. There are many other variables at play which you probably haven't tested.
Pages: 1 2