This is a migrated thread and some comments may be shown as answers.

GetOccurrences wrong results

3 Answers 103 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 21 Jul 2014, 09:43 AM
Hi,

I did the following.
Added a recurring (Daily) Appointment for 2014/07/21 and an exception (changed Time) for 2014/07/22.

With this data I called thisAppointment.GetOccurrences(new DateTime(2014, 7, 1), new DateTime(2014, 7, 10))

From my point of view I should get nothing since the first occurrence of the appointment is at 2014/07/21.
What I get instead is the exception from 2014/07/22.

So asking for an occurrence int the range from 2014/07/01 to 2014/07/10 I get one at 2014/07/22.

Manfred

3 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 22 Jul 2014, 10:34 AM
Hi Manfred,

We managed  to observe the described scenario. Indeed the GetOccurrences() method returns exceptions which are outside of the desired range. We will further research the cause of this behavior.

You can use the GetOccurrencesWithoutExceptionsFromDateTimeRange() method which will not return any of the recurring appointment's exceptions.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
ManniAT
Top achievements
Rank 2
answered on 22 Jul 2014, 11:12 AM
Hi Vladi,

using ...WithoutExceptions... doesn't help since this method does what it is called like.
So the result would not include the exceptional occurrence on 2014/07/22.

Regards,
Manfred
0
Vladi
Telerik team
answered on 22 Jul 2014, 02:29 PM
Hi Manfred,

As mentioned earlier we will do our best to fix the described issue with the GetOccurrences method in the RadScheduleView control. Unfortunately as all of our tasks for the next official release have been planned we cannot estimate if this issue will be resolved in that release. We will do our best to have a permanent fix for it as soon as possible.

In the meanwhile you could easily filter the returned collection by the GetOccurrences method in order to exclude such "incorrect" exception occurrences. The next code snippet shows how to manually filter that collection:
<Button Content="Check occurrences"
        Click="OnButtonClick" />

and it the code:
private void OnButtonClick(object sender, RoutedEventArgs e)
{
    var appointments = this.test.AppointmentsSource.OfType<Appointment>().ToList();
    var start = new DateTime(2014, 7, 1);
    var end = new DateTime(2014, 7, 10);
    var result = appointments[0].GetOccurrences(start, end).Where(o => o.IntersectsWith(new DateSpan(start, end))).ToList();
}

public static class Extensions
{
    public static bool IntersectsWith(this IDateSpan source, IDateSpan other)
    {
        return source != null && other != null &&
                ((other.Start <= source.Start && source.Start < other.End) ||
                (source.Start <= other.Start && other.Start < source.End));
    }
}

I updated your Telerik points for bringing this to our attention. We apologize for any inconvenience that this may be causing.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ScheduleView
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Vladi
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or