GetOccurrences wrong results

4 posts, 0 answers
  1. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 21 Jul 2014 Link to this post

    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
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 22 Jul 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 22 Jul 2014 in reply to Vladi Link to this post

    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
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 22 Jul 2014 Link to this post

    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.
     
Back to Top