Skip to content

Conversation

@betaveros
Copy link
Member

Let the class changes lottery accept multiple requests with priorities from each user, fix up the API and variable names, confirm email details with the user and allow them to customize it, and print more stats.

I haven't tested it yet because I don't have good data to test it on, so I don't think it should be merged yet (worst case we wait until Spring HSSP 2018 :P --- I am reasonably confident in my changes to the class change request form, which are completely independent), but it would be nice if somebody could look it over asynchronously.

betaveros added 12 commits July 9, 2017 19:17
there is no code that handles this in the class changes lottery yet,
also I don't know if everybody who wants class changes lotteries wants
three choices for them and three is hardcoded, so this just goes on prod
Make the lottery accept multiple requests per student per timeblock with
priority, specified by a list of StudentRegistration types.
This might be kind of unfair since all of their requests are now
"stronger" than even the first request from a student with at least one
class. However, it's calculated dynamically so the advantage disappears
once they get their first class, and they don't get any extra priority
when we try to kick students, mostly just because that part of the code
is hard to reason about.
Classify requests by priority, calculate student happiness crudely, and
flag potentially buggy requests.
Take note of the "badness" of the assignment, which is how much it
overflows true class capacities, and add a "pessimism" parameter that
makes the algorithm more conservative about guessing that everybody who
wants to switch out will get to. This way the lottery can be tuned to
not overflow classes. This is a hacky workaround to patch the confusing
student-kicking algorithm applied to "fix" the greedy student-assigning
process, which doesn't always manage to get enrollments below true class
capacities.
This allows for better introspection (shell_plus can autocomplete the
parameters names), alerts you if you misspell a parameter name, puts the
default values right next to the option names, and generally shortens
the code a little.
Separate "orig" and "base" enrollments and capacities, "base" referring
to the state of enrollments after unenrolling students from classes they
want to switch out from, so that enroll_orig and section_capacities_orig
(among others) are consistent with each other about the state of
enrollments, and so that we have the section capacities needed to
print_stats accurately after assignments are saved.
- Make the previously hard-coded check-in room an option, and prompt for
  it as needed
- Slightly paranoidly confirm which email to send the class changes
  email from
- Text formatting
A lot of sums along some axes should have been "any"s.
@willgearty
Copy link
Member

I think merging main will fix the travis test error.

@cjquines cjquines force-pushed the class-change-multi-request branch from ec31921 to 897b7e1 Compare October 8, 2025 21:03
@cjquines cjquines self-assigned this Oct 8, 2025
Comment on lines +49 to +65
def extract_request_rank(self, registration):
reg_name = registration.relationship_name
try:
if '/' in reg_name:
return int(reg_name.split('/')[1])
except ValueError as e:
pass
return 1

def extract_request_rank(self, user, section):
regs = StudentRegistration.valid_objects().filter(
user=user, section=section, relationship__name__startswith="Request")
if regs:
# there should be at most one; should we fail if there are more than one?
return extract_request_rank(regs[0])
else:
return 0
Copy link

Choose a reason for hiding this comment

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

this is... probably not right. but it's what's currently on mit-prod, so i'm just doing this for merge reasons

Copy link
Member

Choose a reason for hiding this comment

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

We should probably do what's right, not just whatever is on mit-prod

@cjquines
Copy link

cjquines commented Oct 8, 2025

(when we merge this, it should be Merge pull request, and neither rebase nor squash)

@willgearty willgearty requested a review from kkbrum October 10, 2025 15:09
@willgearty
Copy link
Member

We're mid testing and release right now, so I probably won't be able to take a look at this until November.

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.

5 participants