Weird bug in GetTicketsBySearch when the date period contains 02/29
Problem reported by Sky Software - 3/14/2016 at 3:20 AM
There is a weird bug in the GetTicketsBySearch method in SmarterTrack Web Services:
If the date range in searchCriteria contains the day 02/29/2016 and the number of days is less than 24 days, the filter is not applied and the method returns all tickets regardless of their date.
// Sample C# code
// A list of "key=value" pairs that indicate the search parameters
svcTickets.ArrayOfString searchCriteria = new svcTickets.ArrayOfString();

// First, search by email address. 

// Then, set the start and end dates.
DateTime startDate = new DateTime(2016, 2, 8, 0, 0, 0);
DateTime endDate = new DateTime(2016, 3, 1, 0, 0, 0);

searchCriteria.Add("DateStartUtc=" + startDate.ToString());
searchCriteria.Add("DateEndUtc=" + endDate.ToString());

// Instantiate the SOAP client and fetch the result, then close the client
svcTickets.svcTicketsSoapClient client = new svcTickets.svcTicketsSoapClient(ticketsEndpointConfig);
svcTickets.TicketInfoArrayResult result = client.GetTicketsBySearch("admin@example.com", "******", searchCriteria);


3 Replies

Reply to Thread
User Replied
I tested this locally and was not able to replicate. I copy-pasted this code and replaced the searching email address and the creditentials to pass for my database, but kept the dates the same. I checked the return results and it did only return results within the date range and with the given email address. Please let me know if i did not test this correctly. I even tested a few other date ranges. If the issue persists I recommend submitting a support ticket so we can take a closer look at your database.
Thank you,
Sky Software Replied
Hello Ashley,
Thank you for your reply. We have just doubled checked. Please try the following date range:

DateTime startDate = new DateTime(2016, 2, 29, 0, 0, 0);
DateTime endDate = startDate.AddDays(7);

The above date range returned all the tickets for the specified user although no tickets actually exist in this particular date range. Thank you.
User Replied
I was testing this on 12x and decided to give it a go in 11x. I had one ticket with email address "blah@blah.com" created on 1/26/2016. I ran the project i built to run the service code with the new dates given. I received no ticket results as expected. I then changed the date to:

DateTime startDate = new DateTime(2016,1, 25, 0, 0, 0);
DateTime endDate = startDate.AddDays(7);

And received 1 ticket as expected. I checked both the Beta of 12 and the latest 11x and unfortunately still cannot reproduce. The issue may be database related? But i cannot say so for sure... Unfortunately, I cannot help any further in the community without being able to reproduce this issue here locally.

Reply to Thread