Skip to content

Conversation

@igbanam
Copy link
Contributor

@igbanam igbanam commented Feb 4, 2025

Story card: sc-14668

Because

Stale patient experiments use up credit meant for current patients

This addresses

Cancelling the experiments for stale patients

Test instructions

  1. Ran the underlying SQL in metabase to confirm the set
  2. Ran the query (without the destroy) in prod to match (1)

@igbanam igbanam self-assigned this Feb 4, 2025
@igbanam igbanam requested a review from aagrawalrtsl February 4, 2025 10:23
class CancelBangladeshStaleExperiments < ActiveRecord::Migration[6.1]
def up
Experimentation::Experiment.upcoming.where(experiment_type: 'stale_patients').each do |experiment|
experiment.destroy # ...because we need the associated notifications gone too
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure, but would this remove the patients from the treatment group, and destroy that group as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you. that's a good catch. patch would be up in a bit

@igbanam igbanam requested a review from aagrawalrtsl February 4, 2025 12:17
@igbanam igbanam merged commit 354c7bb into master Feb 5, 2025
1 check passed
@igbanam igbanam deleted the igbanam/sc-14668/remove-stale-sms branch February 5, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants