IsSlotAvailable conflicting with itself ?

I implemented IsSlotAvailable to prevent double scheduling on my calendar/scheduler


It prevent sliding an event on top of another or adding a new one on top of another.


However, a problem that I did not have before is now present.


If I try to move an event and drop it on top of it previous self, ie moving an 1h event ahead by 30 minutes.  IsSlotAvailable returns false.  If I move it up 60 minutes, it does not.  So as I understand it, it does not exclude itself from the potential conflict candidates.


How would I go about fixing that ?

Snippet
	public async void OnResizeStop(ResizeEventArgs<ScheduleData.ResourceDatadata )
	{
		if (!await SfScheduleVets.IsSlotAvailable(data.StartTime, data.EndTime, data.GroupIndex))
		{
		    toastService.ShowWarning($"Moving visit {data.Data.Subject} to {data.StartTime} is not possible because of a conflict""Failure");
			data.Cancel = true;
			return;
		}
			 
		MyViewModel.Update(data.Data).SafeFireAndForget();
 
		toastService.ShowSuccess($"Visit {data.Data.Subject} has been moved to {data.StartTime}. It will end at {data.EndTime}""Success");
 
 
	}

thanks




3 Replies 1 reply marked as answer

RM Ruksar Moosa Sait Syncfusion Team July 28, 2022 03:29 PM UTC

Hi Frederic,


Greetings from Syncfusion support.


We have validated your shared code and suggest you to directly pass the Data values (args.Data) as the parameter to the IsSlotAvailableAsync method to overcome the reported issue.


public async void OnResizeStop(ResizeEventArgs<AppointmentData> args )

    {

        if (!await ScheduleObj.IsSlotAvailableAsync(args.Data))

        {

            //code here

        }   

    }


Kindly try the above solution and let us know if this meets your requirement.


Regards,

Ruksar Moosa Sait


Marked as answer

FR Frederic August 1, 2022 03:44 PM UTC

That did it, thanks for your help



RV Ravikumar Venkatesan Syncfusion Team August 2, 2022 05:03 AM UTC

Hi Frederic,


Thanks for the update.


We are happy that our solution helped you to achieve your requirement.


Regards,

Ravikumar Venkatesan


Loader.
Up arrow icon