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

Implement Ticket Cooldowns and Daily Ticket Limits #649

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

Conversation

ajaygandecha
Copy link
Member

@ajaygandecha ajaygandecha commented Nov 23, 2024

This pull request adds the ability for instructors to set a ticket cooldown (minimum time between tickets for the same person) and daily ticket limits (for each user) to better manage office hours and to encourage self exploration and problem solving, as well as to lessen the burden on TAs and decrease the chance that TAs complete assignments for students.

Backend Changes

  • There are two new fields added to the course_site table that for ticket cooldowns and daily ticket limits.
    • Default for ticket cooldown has been set to 0 minutes.
    • Default for max tickets / day has been set to 100.
  • The ticket creation logic has been extended to include these new limits, throwing descriptive errors back to the frontend when these limits have been met.

Migrations are likely required here.

Frontend Changes

  • Added new fields to the course site's "Settings" tab that includes these settings:
Screenshot 2024-11-23 at 2 24 04 PM

Other Notes

I would like to pair this with #631 if possible. Can we get this reviewed @KrisJordan / @jadekeegan?

Limitations

  • Currently, this implementation does not account for groups, since group tickets have not been implemented yet. I want to land web sockets and other optimizations before attempting this.

@ajaygandecha ajaygandecha added feature New feature or request REQUIRES MIGRATION labels Nov 23, 2024
@ajaygandecha ajaygandecha self-assigned this Nov 23, 2024
)

# Check if tickets exceed maximum in 24hrs.
days_cutoff = datetime.now() + timedelta(days=-1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: Is there a way to do this on a standard day rather than past 24 hours? Maybe basing the cutoff on the first OH event of the current day?


if num_tickets_in_last_day >= course_entity.max_tickets_per_day:
raise CoursePermissionException(
f"You have created the maximum number of tickets you can for this course in 24 hours. Please come back later."
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: More information in this exception could be useful.

error: (_) => {
this.snackBar.open(`Could not create a ticket at this time.`, '', {
error: (err) => {
this.snackBar.open(`${err.error.message}`, '', {
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue: It might be better if ticket creation is completely disabled for the user before they even attempt to create it and send a request to the backend. Both to reduce the number of unnecessary requests and to avoid situations where a user unknowingly creates a ticket before the cooldown/limit is over, writes a whole description, and then loses it. This will obviously require more work and refactoring though, so could be relegated to a future ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request REQUIRES MIGRATION
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants