Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If no classes in current timeframe, display first week of classes. #15

Open
MikeiLL opened this issue Sep 27, 2018 · 12 comments
Open

If no classes in current timeframe, display first week of classes. #15

MikeiLL opened this issue Sep 27, 2018 · 12 comments

Comments

@MikeiLL
Copy link
Owner

MikeiLL commented Sep 27, 2018

This should be the case with events as well, but there's an easy workaround for that which is just a longer Option period for Events display cycle.

Or could display empty calendar starting on current week.

This would require either a second call to the API or the initial call would need to have an arbitrary end date. A second call to the API seems to make sense, then display first week of classes within the

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

@rtzee
Copy link
Contributor

rtzee commented Sep 27, 2018

I think this is really only important for a new studio that is launching before classes actually start. Of course they can link to MBO schedule in the interim. Could we only trigger the second API call if the first call returned an empty set? That seems like the best strategy to reduce the overhead.

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

Yes. I think that makes sense. I'm actually not quite sure how to test this. Not sure if I can remove ALL the classes for current week from the Sandbox MBO site (-99 account).

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

Is #249 $this->classes = $schedule_data; in inc/common/interfaces/class-retrieve-classes.php an empty array with your current API call?

@rtzee
Copy link
Contributor

rtzee commented Sep 27, 2018

Yep. we won't have classes until next week so we get an empty result when calling the current week. This is what lead me to change the "error" message in inc/frontend/views/horizontal_schedule.php

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

Actually it may by $this->schedule_object->classes['GetClassesResult']['ResultCount'] on line #234 that we want to use in inc/schedule/class-display.php.

@rtzee
Copy link
Contributor

rtzee commented Sep 27, 2018

So would we have to keep making sequential API requests until we got a non zero result for ResultCount? Or is there an API call to get the "next available class" and then use that date to determine the date range of the corresponding week?

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

Or is there an API call to get the "next available class" and then use that date to determine the date range of the corresponding week?

Good question. Doesn't look like it https://developers.mindbodyonline.com/PublicDocumentation/ClassService?version=v5.1

@rtzee
Copy link
Contributor

rtzee commented Sep 27, 2018

So I guess we'd need to do a larger range like 60 days on the second API call and then, if there was a class, a third API call to show the correct week.

Kinda sounds like a lot of work for a really small use case.

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

The code I just pushed out might achieve (this first part of) this. Would you mind seeing what happens if you use it without current classes?

@MikeiLL
Copy link
Owner Author

MikeiLL commented Sep 27, 2018

(on the noclasses branch.)

@rtzee
Copy link
Contributor

rtzee commented Sep 27, 2018

Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants