Skip to content

Pause study when max responses limit is reached#1832

Draft
becky-gilbert wants to merge 6 commits intoadd-max-responses-to-studyfrom
pause-max-responses
Draft

Pause study when max responses limit is reached#1832
becky-gilbert wants to merge 6 commits intoadd-max-responses-to-studyfrom
pause-max-responses

Conversation

@becky-gilbert
Copy link
Contributor

@becky-gilbert becky-gilbert commented Feb 11, 2026

This addresses part of #1829 but should not close the issue.

This PR adds logic to the Study model's check_and_pause_if_at_max_responses method. This method checks if the study:

  • has a max responses value
  • is active
  • has reached its max valid responses value

And if all of the above is true, it automatically pauses the study.

The pause transition triggers a notification email sent to site admins. This callback had to be edited to allow the caller (a user) to be an optional argument, since we've now added the ability for study states to change without a user/caller.

This PR also adds tests for the check_and_pause_if_at_max_responses method.

To do:

  • Call the check_and_pause_if_at_max_responses method at all necessary points/events:
    • when a completed/eligible/non-preview response is received for an internal study
    • when a eligible/non-preview response is created for an external study
    • when the max responses value is updated for a study
    • when a response's validation status is manually changed on the individual responses page
    • when a researcher tries to change the study state to active
  • Update the check_and_pause_if_at_max_responses method to include additional triggers that are not included in the user-invoked pause transition:
    • notification email sent to study researchers
    • banner message on screen (for researcher-invoked changes)

…ax responses value, is active, and has reached limit; update pause trigger to make caller/user arg optional
@becky-gilbert becky-gilbert added the Feature [Work Type] Adding new functionality to the platform label Feb 11, 2026
@becky-gilbert becky-gilbert self-assigned this Feb 11, 2026
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature [Work Type] Adding new functionality to the platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCOPING: cap number of participants, condition counterbalancing, cap by criteria

1 participant