Marc358 / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 0 forks source link

Meetings not rendered if last day in month is also last day in month view #94

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Find a month where the last day in the month is also the last day of the 
last week of the month (like July 2010 using en locale).
2. Book a meeting on the last day of that month.
3.  Choose Month view (the last day of the month is the last day rendered).

What is the expected output?
The meeting should be rendered.

What do you see instead?
No meetings booked on that day are rendered.

What version of the product are you using? gwt-cal 0.9.2

On what operating system? www!

----

We've traced the bug down to the class MonthLayouthDescription which has a 
method with this signature:

    private boolean overlapsWithMonth(Appointment appointment,
          Date calendarFirstDate, Date calendarLastDate)

The problem with this is that what you're really interested in when comparing 
these overlaps is `calendarFirstTime` and `calendarLastTime`, respectively. It 
doesn't matter for the former, but for the latter it's a big difference since 
using dates for this the month ends at the _start_ of the last day.

Original issue reported on code.google.com by CoB...@gmail.com on 1 Nov 2010 at 11:15

GoogleCodeExporter commented 8 years ago
My search for previous reports was sloppy. I now see that this problem has also 
been reported in Issue 83.

Original comment by CoB...@gmail.com on 1 Nov 2010 at 11:23

GoogleCodeExporter commented 8 years ago
I've modified the placeAppointments method of MonthLayoutDescription class:
 - I've added a new Date variable: dayAfterCalendarLastDay which is the next day after the calendar last day.

 - I've changed the call to overlapsWithMonth method from,
overlapsWithMonth(appointment, calendarFirstDay, calendarLastDay)
to
overlapsWithMonth(appointment, calendarFirstDay, dayAfterCalendarLastDay)

Now the events from the last day displayed on month view are rendered.

[...]
    private void placeAppointments(ArrayList<Appointment> appointments, int maxLayer) {
        Date dayAfterCalendarLastDay = (Date) calendarLastDay.clone();
        dayAfterCalendarLastDay.setDate(dayAfterCalendarLastDay.getDate() + 1);
        for (Appointment appointment : appointments) {
            if (overlapsWithMonth(appointment, calendarFirstDay, dayAfterCalendarLastDay)) {
                int startWeek = calculateWeekFor(appointment.getStart(), calendarFirstDay);

                /* Place appointments only in this month */
                if (startWeek >= 0 && startWeek < weeks.length) {
                    initWeek(startWeek, maxLayer);
                    if (appointment.isMultiDay() || appointment.isAllDay()) {
                        positionMultidayAppointment(startWeek, appointment, maxLayer);
                    } else {
                        weeks[startWeek].addAppointment(appointment);
                    }
                }
            }
        }
    }

[...]

Original comment by alin.par...@gmail.com on 10 Feb 2011 at 1:25

Attachments:

GoogleCodeExporter commented 8 years ago
OP noticed this is a duplicate of Issue 83, which was resolved in revision 365.
Closing as duplicate.

Original comment by carlos.m...@gmail.com on 17 May 2011 at 3:09