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

change when the review_update webhook sends #56

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

nsandler1
Copy link
Member

OLD: the review_updates webhook would execute if (Review.pending.count + Professor.pending.count) % WEBHOOK_FREQUENCY == 0. This method would cause the webhook to execute inconsistently when users used the add_professor form because instead of increasing the count by 1, the count would increase by 2 which often skipped over numbers divisible by WEBHOOK_FREQUENCY. In other words, the sum in the above conditional statement would always be skewed by Professor.pending.count and never increased linearly.

NEW: this PR would have the webhook execute if Review.pending.count % WEBHOOK_FREQUENCY == 0. Each time this code is called (in add_professor.py and professor.py), we compare the number of pending reviews and if there happens to be unverified professors when the message is getting ready to send, the message will indicate how many there are BUT this number doesn't affect when the message will send. Only the number of reviews affects that.

Copy link
Contributor

@tybug tybug 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 test but code read looks good.

@tybug tybug merged commit 9457c88 into master Dec 14, 2022
@tybug tybug deleted the webhook-frequency branch December 14, 2022 21:07
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.

2 participants