krico / jas

Janes Asmussen Szarmach
3 stars 1 forks source link

API query is finding activities based on end date not start date #482

Open pauljanes opened 9 years ago

pauljanes commented 9 years ago

I am querying on mywayfit for dance activities from ZeoT. There are 5 activities in total. The search (see screenshot) only returns two results. The reason being that the query is querying by end date not start date.

These are activities that span multiple weeks. I had to create them like this because its a course and they cannot be booked individually. So my only option was to create them as a single activity with start date on the start date of the course and end date on the end date of the course.

But the query ought to consider the start date not the end date as this is how subscribers will be searching for them on mywayfit. If I say show me all courses in June I would for instance expect to also see courses that start in June and end in August.

screen shot 2015-06-01 at 07 28 08

wszarmach commented 9 years ago

You have added the following activities:

The query considers both start and finish date. The logic is find all activities that start on or after the supplied start date and finish on or before finish date. If you want to find all activities that start after a certain date only you can send null for the finish date.

As a side note; In your image you appear to have a mixture of date formats. YYYY-MM-DD vs MM/DD/YYYY.

pauljanes commented 9 years ago

But from a user point of view this isnt covering all their requirements. They will want to see a limited selection of activities - not ALL activities that start after start date. They want to see activities STARTING between 2 defined dates. And based on your feedback it is not clear that the query can cover this case. As a user you are more interested in when the start date lies, rather than where the end date lies.

Sent from my iPhone

On 01.06.2015, at 08:14, "wszarmach" notifications@github.com wrote:

You have added the following activities:

03/06/2015 - 01/07/2015 - Found because falls within search range 07/07/2015 - 25/08/2015 - Not found as you entered search finish date to be 24/08/2015 08/07/2015 - 08/07/2015 - Found because falls within search range 08/07/2015 - 26/08/2015 - Not found as you entered search finish date to be 24/08/2015 09/07/2015 - 27/08/2015 - Not found as you entered search finish date to be 24/08/2015 The query considers both start and finish date. The logic is find all activities that start on or after the supplied start date and finish on or before finish date. If you want to find all activities that start after a certain date only you can send null for the finish date.

As a side note; In your image you appear to have a mixture of date formats. YYYY-MM-DD vs MM/DD/YYYY.

— Reply to this email directly or view it on GitHub.

pauljanes commented 9 years ago

Yes there is a mix of date formats - the entry format is YYYY-MM-DD and the display format is something else. The website designer is working on that. But it doesnt have any impact on this issue though.

pauljanes commented 9 years ago

For now I have hacked it on mywayfit, so that I pass endDate as null and then I filter out the ones that I dont want on the site itself. Long term though this wont be ideal as I am querying many more results than I need. When we have thousands of classes it means I will be hitting the datastore harder than I need to. But as I managed to hack it to achieve what I want short term, I have removed the blocker label.

wszarmach commented 9 years ago

Sorry was explaining how it works and how it can be currently worked around

wszarmach commented 9 years ago

Currently filtering is done after calling datastore so their is no impact on datastore