Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Error messages for generating schedules #423

Merged
merged 32 commits into from Nov 29, 2020

Conversation

rachelconn
Copy link
Collaborator

Description

Adds messages describing what went wrong when generate schedules doesn't return any schedules. I'd appreciate if everyone could try to think of other reason generating schedules might fail so we can be sure these error messages are accurate and cover everything that could possibly go wrong.

Rationale

There are a couple assumptions I make to avoid making extra queries just to check if sections still exist in the queryset:

  • Courses have sections for the term given (since when searching for courses it only gives courses with sections in the current term, this should be fine)
  • Web/honors filters don't result in an empty queryset (I made changes to make sure this assumption is always valid on the frontend, as before when the course changed it didn't change your existing choice for web/honors)

With these assumptions, these are the three ways generating schedules can fail and their messages:

_NO_SECTIONS_WITH_SEATS = (
    'None of the sections you selected for {subject} {course_num} have available seats.'
)
_NO_SECTIONS_MATCH_AVAILABILITIES = (
    'No sections for {subject} {course_num} are compatible with your available times. '
    'Either select more sections, or remove some of your busy times.'
)
_NO_SCHEDULES_POSSIBLE = 'No schedules are possible with your selected constraints.'

There's also the possibility that the call fails (since the server is down or the schedules are malformatted), for this case I added another message to the frontend saying that something went wrong.

I also refactored the section filters on the frontend to use an enum for consistency, since it's always bothered me that we use explicit values and this PR is vaguely related to section filters.

How to test

Try to generate schedules with various constraints that may or may not result in no schedules being generated. I think I was pretty thorough with the ways the call can fail, but there's always the possibility I missed something.

Screenshots

Previous error message:
image

Example new error messages:
image
image
image

Related tasks

Closes #399.

@rachelconn rachelconn added feature Something that adds new functionality frontend Anything related to the frontend - React, etc backend Anything related to the backend API/Django change Changes previously existing functionality labels Oct 25, 2020
@rachelconn rachelconn self-assigned this Oct 25, 2020
@rachelconn
Copy link
Collaborator Author

Other ideas for the no schedules possible text:

  • It's impossible to make any schedules without overlapping classes and your constraints. Either select more sections or remove some of your busy times.
  • Your constraints are too strict to create any valid schedules. Either select more sections or remove some of your busy times.

What does everyone think? I think these are clear enough to tell the user both what went wrong and how to fix it.

Copy link
Member

@gannonprudhomme gannonprudhomme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will review this again, but some minor comments I had the other day

autoscheduler/scheduler/tests/api_tests.py Show resolved Hide resolved
autoscheduler/frontend/src/redux/actions/courseCards.ts Outdated Show resolved Hide resolved
@rachelconn
Copy link
Collaborator Author

I found 2 more failure cases (and by that I mean I found one and the other is one I missed from the issue Gannon made), here are the messages since they're pretty self explanatory:
image
image

@firejake308
Copy link
Collaborator

I think that was separate PR

@rachelconn
Copy link
Collaborator Author

I think that was separate PR

Correct, we don't have a mockup for a new design and I wanted this PR to be focused on the functionality itself rather than the styling of how we display it

@gannonprudhomme
Copy link
Member

gannonprudhomme commented Oct 30, 2020

Still messing with this & will probs continue later, but one thing I noticed is that if there's a conflict between one thing it'll catch it 100% of the time (e.g. if your availabilities are completely knocking out a single course), but if there's like 2 sections in one course and 2 sections in another course and an availability blocks off one each (and the remaining sections intersect with each other), it's going to give the generic "No schedules are possible", even though removing the availability would result in a possible schedule.

Here's a super specific example of it:

  • Term: 202031
  • Course 1: CSCE 482. Section customization level, selected sections 900 and 901
  • Course 2: ACCT 209. Section customization level, selected sections 501 and 502
  • Include full sections selected

Generate schedules and you'll see there are two available ones
chrome_VpJXWi97mD

But if you block off from 8:30 - 12:00 on Monday it'll give you the generic "no schedules are possible", even though removing the availability would fix it.

@gannonprudhomme
Copy link
Member

gannonprudhomme commented Oct 30, 2020

Also anytime it mentions a specific section as the reason, you should bold the section text so you immediately focus on it.

@rachelconn
Copy link
Collaborator Author

Also anytime it mentions a specific section as the reason, you should bold the section text so you immediately focus on it.

Do you still want me to implement this? We don't post-process text anywhere else so I'm wondering how you want me to go about doing it

Still messing with this & will probs continue later, but one thing I noticed is that if there's a conflict between one thing it'll catch it 100% of the time (e.g. if your availabilities are completely knocking out a single course), but if there's like 2 sections in one course and 2 sections in another course and an availability blocks off one each (and the remaining sections intersect with each other), it's going to give the generic "No schedules are possible", even though removing the availability would result in a possible schedule.

Since you could either add more sections or remove busy times to fix the issue in most cases and narrowing it down more than that is impossible unless all sections are selected for all classes on your schedule, I'm not going to implement this

I'd also appreciate feedback from someone on what to change the generic error message to (see my earlier comment)

@gannonprudhomme
Copy link
Member

Do you still want me to implement this? We don't post-process text anywhere else so I'm wondering how you want me to go about doing it

If it's possible yeah, I think it would be beneficial

I'd also appreciate feedback from someone on what to change the generic error message to (see my earlier comment)

Your constraints are too strict to create any valid schedules. Either select more sections or remove some of your busy times. This one sounds better

@firejake308
Copy link
Collaborator

firejake308 commented Oct 31, 2020

Your constraints are too strict to create any valid schedules. Either select more sections or remove some of your busy times.

I like how the second half gives suggestions for how to fix it, but the first part feels a little confrontational to me. I would try No schedules found. Either select more sections or remove some of your busy times.

@gannonprudhomme
Copy link
Member

gannonprudhomme commented Oct 31, 2020

the first part feels a little confrontational to me.

Agreed, definitely cause the usage of your.

I would try No schedules found. Either select more sections or remove some of your busy times.

I think No schedules possible for the first part would be slightly better - that way they know it's not us ("rev registration"), it's their schedule/constraints that are the problem

@rachelconn
Copy link
Collaborator Author

rachelconn commented Oct 31, 2020

Do you still want me to implement this? We don't post-process text anywhere else so I'm wondering how you want me to go about doing it

If it's possible yeah, I think it would be beneficial

I don't think it's that helpful and I'm not sure how I would go about doing it, so for now I'm going to leave it as-is. We can make it into a separate issue if we decide that we want it to work like that, but I don't want it to hold up this getting merged before launch

Also I changed the generic message to:
No schedules possible. Either select more sections or remove some of your busy times.

So if we agree the bold text isn't a big enough deal to prevent this from getting merged this should be ready for review

Copy link
Member

@gannonprudhomme gannonprudhomme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't do any testing just looked at code, so will look at this again later today (hopefully)

Comment on lines 62 to 63
// Fetches scheduler/generate. If something goes wrong or no schedules can be generated,
// throws an error with a message indicating what happened.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Fetches scheduler/generate. If something goes wrong or no schedules can be generated,
// throws an error with a message indicating what happened.
/** Fetches scheduler/generate. If something goes wrong or no schedules can be generated,
throws an error with a message indicating what happened. */

So it shows up as a doc when you hover over the function

Comment on lines +20 to +21
'{subject} {course_num}: None of the sections you selected are compatible with your '
'available times. Either select more sections, or remove some of your busy times.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be switching between available and busy here? I get why you did it but just wanted to double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking about that as I wrote this, and it doesn't really make sense if it uses one or the other so I left it like this

Comment on lines 70 to 71
))
return sections
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick lol

Suggested change
))
return sections
))
return sections

'schedules': [[SectionSerializer(section).data for section in self.sections]],
'message': '',
}
print(expected)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(expected)

autoscheduler/scheduler/tests/scheduling_tests.py Outdated Show resolved Hide resolved
autoscheduler/scheduler/views.py Outdated Show resolved Hide resolved
@gannonprudhomme
Copy link
Member

Also need to merge master into this, presumably b/c #417

@rachelconn
Copy link
Collaborator Author

Changes made except the chained .thens, and I merged in master

Copy link
Member

@gannonprudhomme gannonprudhomme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I'd like you to at least investigate into why the snackbar is appearing so large:
chrome_I0bkcrw52V

And try to make it smaller - I seriously hate how large this is. Ik we're going to eventually move away from the snackbar, but since that's probs a ways away I still want this to look good

@rachelconn
Copy link
Collaborator Author

rachelconn commented Nov 15, 2020

image
I made a theme override to put the message and actions on the same line (since the old behavior is what material ui wants to do by default), also rebased with master

@rachelconn rachelconn merged commit d5bc6f2 into master Nov 29, 2020
@rachelconn rachelconn deleted the generate-schedules-error-messages branch November 29, 2020 23:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend Anything related to the backend API/Django change Changes previously existing functionality feature Something that adds new functionality frontend Anything related to the frontend - React, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add calculating+displaying of the reason /scheduler/generate failed
3 participants