-
Notifications
You must be signed in to change notification settings - Fork 88
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
Implement individual students stickying #1723
Conversation
8c235c7
to
df67d6c
Compare
55b02c9
to
9bad520
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work - it looks like the core feature is working.
I don't know if you've noticed this, maybe it only occurs when you have a fairly large scheduling page (lots of instances), but the page load time is very slow. Run the dev autogenerate data scripts if you haven't. I'm getting 15s page load vs. 2s on production, and my dev is usually faster than prod. I assume it's due to populating all the fields with all those users. So we have to optimize this somehow. Maybe use JS and only populate the field when the user clicks on it?
And a few feature suggestions:
- Can you distinguish between activity-sticky activities and user-sticky activities to the student? Right now they look the same to the student. Probably make the badge say "User Sticky" with an explanation tooltip instead of just "Sticky."
- What do you think about sending an email to the user when they get user-sticked into an activity?
9bad520
to
4d1140a
Compare
I just pushed a commit that populates it as soon as the page has loaded. Could you check if that's fast enough for you? As for sending an email, I'm not sure how much I would like that as a user - but I could also see it being really helpful for some people. As such, I'm -0 on the idea: if you really think it's useful/important, I can implement it. |
4ca8bd3
to
67d71e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is great, it loads very quickly now. But it doesn't seem to work anymore? When I put a user in and save it doesn't actually do anything, and the field gets wiped? Is it on my end?
Did you change the name to 'user sticky'? Also yes - email would be helpful if you can add that. |
30fe65a
to
781dc23
Compare
I haven't implemented email yet (if I get a chance later, I can do that), but everything else should be done, namely:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good and almost there
781dc23
to
d726662
Compare
d726662
to
efe5a47
Compare
intranet/apps/eighth/models.py
Outdated
signup = EighthSignup.objects.filter(user=user, scheduled_activity__block=self.block).first() | ||
if signup is not None: | ||
signup.remove_signup(user, force=True) | ||
EighthSignup.objects.create_signup(user, scheduled_activity=self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not the right way to do it, I think...again look at the signup view. I took a look myself and I believe you need to use EighthScheduledActivity.add_user
You have been stickied into {{ activity.activity.name }} on {{ activity.date }} ({{ activity.block_letter }}). | ||
|
||
If there has been a mistake with this change, please contact the 8th period office. | ||
Have a nice day! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think you need this lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It never hurts to tell people to have a nice day :)
@@ -1097,10 +1115,50 @@ def notify_waitlist(self, waitlists: Iterable["EighthWaitlist"]): | |||
[waitlist.user.primary_email_address], | |||
) | |||
|
|||
def set_sticky_students(self, users: "Sequence[AbstractBaseUser]") -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes good
# note: this will send separate emails to each student for each activity they are stickied in | ||
new_stickied_students = (user for user in users if user not in old_sticky_students) | ||
unstickied_students = (user for user in old_sticky_students if user not in users) | ||
email_send_task.delay( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this works
efe5a47
to
9d33d97
Compare
9d33d97
to
19ffbfd
Compare
Proposed changes
Allow stickying individual students to a scheduled 8th period.
Brief description of change
Closes #1719
ManyToManyField
toUser
calledsticky_students
.EighthScheduledActivity.is_user_stickied(user)
which checks if an individual user is stickied, replacing the oldget_sticky
method.You can edit the stickied students at
/eighth/admin/scheduling/schedule?activity=<some_activity_pk>