Skip to content

Replace manual username input with Select dropdown for student remova…#21

Open
SillyNY wants to merge 7 commits into
softwareconstruction240:mainfrom
SillyNY:main
Open

Replace manual username input with Select dropdown for student remova…#21
SillyNY wants to merge 7 commits into
softwareconstruction240:mainfrom
SillyNY:main

Conversation

@SillyNY

@SillyNY SillyNY commented Jun 4, 2026

Copy link
Copy Markdown

Summary

Replaced the manual username text input in the "Remove Student" flow with a two-step dropdown-based interface. TAs
no longer need to type or copy/paste exact usernames.

What changed

  1. Clicking Remove Student now opens a Select dropdown listing all students currently in the queue, with their
    display name, queue position, and type (help/passoff)
  2. Selecting a student opens a confirmation modal showing the student's name, with an optional reason field
  3. Removal is performed by user_id instead of string-matching the username — no more failed matches from typos

Files modified

File Change
ui/modals.py Rewrote RemoveConfirmModal: removed the username TextInput; now receives user_id + display
name via constructor; removal uses user_id directly
ui/views/ta_view.py Added RemoveStudentView class (a discord.ui.View with a dynamically populated
Select); updated the "Remove Student" button callback to show the dropdown first

Test Plan

  • Queue is empty → "Queue is empty" message shown, no dropdown
  • Queue has 1+ students → dropdown lists all of them with correct labels and queue positions
  • Selecting a student → confirmation modal opens with the correct student name displayed
  • Confirming removal → student is removed from queue, receives a DM, queue display updates
  • Optional reason field → reason text appears in the DM sent to the student
  • Race condition: two TAs open the dropdown, one removes a student, the other selects the same student → "That
    student is no longer in the queue." message shown

Notes

  • Discord Select supports a maximum of 25 options. If the queue grows beyond that, entries[:25] should be
    used (not yet implemented — CS 240 queue sizes are typically under this limit)
  • The dropdown times out after 30 seconds

Fixes: #4

…l The Remove Student button now shows a dropdown list of all students currently in the queue, eliminates exact username matching.
@TwoLettuce

TwoLettuce commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Hey @SillyNY, this is great work! A few bugs small bugs I came across while testing:

  • If you use the dropdown to select a student, then cancel the Remove Confirmation modal, you are unable to select that student again until you select another student, then reselect the first student. That might be a limitation with discord, but it is a problem if there is only one student in the queue. I suggest that you could add a "None" option that you can click in the dropdown that doesn't do anything, but allows you to again select that student.
  • In other cases when a student becomes first in the queue, they receive a message to let them know they'll be helped soon. If you would implement that for when the first student in line gets removed, that would be super helpful.

And one small improvement to the Remove Student message that includes the dropdown: I'd like it to label each emoji so that the TAs can know what they mean. Something like ✅=Passoff, ❓=Question.

If you make those changes, I'll go ahead and merge your PR!

@TwoLettuce TwoLettuce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See above

@SillyNY

SillyNY commented Jun 5, 2026

Copy link
Copy Markdown
Author

@TwoLettuce Thank you for spending time on my code. You're right — I didn't think through those edge cases carefully enough. I've since addressed them and written scripts to verify the fixes, though I'll be honest: I haven't checked the final output live on Discord yet. Would appreciate your eyes on it.

@TwoLettuce

Copy link
Copy Markdown
Contributor

Hey @SillyNY, thanks for making those changes and for making tests for it!

Since our entire team speaks English, all comments and documentation should be in English so that we can all contribute to the project's maintenance. We also would like to keep the project organized, so I request that you create a package for the test file you created where we can put more test files we create in the future. Additionally, modals.py has some redundant imports. If these commits were created with an AI agent, please manually review the code. Would you mind making those changes as well?

@TwoLettuce TwoLettuce self-requested a review June 8, 2026 21:02
In discord_helpers.update_queue_messages, the old names for update_status and update_count were used instead of what @Aryan-Shastri ended up naming them. The naming conflict was then remedied and more useful names provided for those methods.
@TwoLettuce

Copy link
Copy Markdown
Contributor

@bsharplydian, could you review this PR when you have a chance?

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.

Better interface for removing student

2 participants