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

Fix: Optimize course times display #302

Open
wants to merge 2 commits into
base: oss
Choose a base branch
from

Conversation

rm-yakovenko
Copy link
Contributor

@rm-yakovenko rm-yakovenko marked this pull request as draft March 29, 2022 13:56
@rm-yakovenko rm-yakovenko marked this pull request as ready for review March 29, 2022 15:15
@thdebay
Copy link
Collaborator

thdebay commented Apr 2, 2022

I'll take more time to review your code more in depth. From what I've seen, it works great and you've covered all the use cases.

I think we could tweak your algorithm a bit so that a course that occurs several days a week, always at the same time would always be "grouped" according to the time first : Mon, Tue, Thu 10:00 - 12:00 (maybe put a check to see it all times are equal at the start of the method, and then if the check fails, the behavior you've proposed is perfect).

@thdebay
Copy link
Collaborator

thdebay commented Apr 2, 2022

Also, it's important to check if $courseTimes is null otherwise it will throw an error when at foreach()

@rm-yakovenko
Copy link
Contributor Author

I'll take more time to review your code more in depth. From what I've seen, it works great and you've covered all the use cases.

Sure, I'm open to any feedback or questions.

I think we could tweak your algorithm a bit so that a course that occurs several days a week, always at the same time would always be "grouped" according to the time first : Mon, Tue, Thu 10:00 - 12:00 (maybe put a check to see it all times are equal at the start of the method, and then if the check fails, the behavior you've proposed is perfect).

I think "grouping by time" will make the code much simpler, as there is no need to find sequences of days.

How should it work in this case?
https://github.com/academico-sis/academico/blob/oss/tests/Unit/CourseTest.php#L187-L208

Also, it's important to check if $courseTimes is null otherwise it will throw an error when at foreach()

Fixed, I totally forgot about this case.

@thdebay
Copy link
Collaborator

thdebay commented Apr 3, 2022

How should it work in this case? https://github.com/academico-sis/academico/blob/oss/tests/Unit/CourseTest.php#L187-L208

I would say that it should stay exactly as you suggested. Unless all the course times are exactly the same throughout the week, we apply your algorithm unchanged. What do you think?

@rm-yakovenko
Copy link
Contributor Author

How should it work in this case? https://github.com/academico-sis/academico/blob/oss/tests/Unit/CourseTest.php#L187-L208

I would say that it should stay exactly as you suggested. Unless all the course times are exactly the same throughout the week, we apply your algorithm unchanged. What do you think?

Honestly, I don't know ;) It depends on the UX and what's best for the users.

Having Mon, Tue, Thu 10:00 - 12:00 leads to simpler code and will be easier to maintain rm-yakovenko@87b9d09 .

I'm still struggling with this test https://github.com/academico-sis/academico/blob/oss/tests/Unit/CourseTest.php#L187-L208:

Failed asserting that two strings are identical.
Expected :'Mon 10:00 AM - 11:00 AM / 11:30 AM - 12:45 PM'
Actual   :'Mon 10:00 AM - 11:00 AM | Mon 11:30 AM - 12:45 PM'
<Click to see difference>

 /var/www/app/tests/Unit/CourseTest.php:207

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

Successfully merging this pull request may close these issues.

None yet

2 participants