Skip to content

Add reuse seeds and helper#2204

Open
ericaporter wants to merge 11 commits intomainfrom
create-reuse-seeds
Open

Add reuse seeds and helper#2204
ericaporter wants to merge 11 commits intomainfrom
create-reuse-seeds

Conversation

@ericaporter
Copy link
Contributor

@ericaporter ericaporter commented Feb 10, 2026

Ticket here

Context

We are introducing deterministic ReuseChoices scenario seeds used in staging for Product to test the reuse vs non-reusable partnership scenarios (listed below)

We want the reuse seed to:
-remain separate to the core seeds but still able to run on staging for product to review

Changes proposed in this pull request

The seed still guarantees:

17 deterministic URN-based schools
historical ECT + training data
reusable vs non-reusable scenarios
correct provider/partnership setup in the target year
No behavioural changes are expected in the UI or tests beyond improved stability.

Guidance to review

Spot-check one reusable and one non-reusable case
Running the seed multiple times should not create duplicates
Specs should pass consistently in isolation

Scenarios the seeds need to cover

First ever ECT at a school registered in 2025 contract period with LP1 & DP1.
-> Next ECTs should always show reuse choices screen (as there will always be a valid previous choice for 2025)
School with no previous ECTs, mentors or partnerships

Last ECT in 2024 contract period registered with LP1 & DP1; and LP1& DP1 are still an available pairing in 2025.
-> Next ECTs registered in 2025 contract period should always show reuse choices screen (as there will always be a valid previous choice for 2025)
School with an ECT in 2024 contract period & confirmed partnership, where the 2024 LP/DP is also available in 2025
School with an ECT in 2024 contract period with EOI but no confirmed partnership, where the 2024 LP is available in 2025
School with an ECT in 2023 contract period & confirmed partnership, where the 2024 LP/DP is also available in 2025
School with an ECT in 2023 contract period with EOI but no confirmed partnership, where the 2024 LP is available in 2025
School with an ECT in 2022 contract period & confirmed partnership, where the 2024 LP/DP is also available in 2025
School with an ECT in 2022 contract period with EOI but no confirmed partnership, where the 2024 LP is available in 2025
School with an ECT in 2021 contract period & confirmed partnership, where the 2024 LP/DP is also available in 2025
School with an ECT in 2021 contract period with EOI but no confirmed partnership, where the 2024 LP is available in 2025

Last ECT in 2024 contract period registered with LP1 & DP1; and LP1& DP1 are not an available pairing in 2025.
-> Next ECT registered in 2025 contract period should not show reuse choices screen (as there is no valid previous choice for 2025).
-> But any next ECTs after that should always show reuse choices screen (as there will now be a valid previous choice for 2025).
School with an ECT in 2024 contract period & confirmed partnership, where the 2024 LP/DP is not available in 2025
School with an ECT in 2024 contract period with EOI but no confirmed partnership, where the 2024 LP is not available in 2025
School with an ECT in 2023 contract period & confirmed partnership, where the 2024 LP/DP is not available in 2025
School with an ECT in 2023 contract period with EOI but no confirmed partnership, where the 2024 LP is not available in 2025
School with an ECT in 2022 contract period & confirmed partnership, where the 2024 LP/DP is not available in 2025
School with an ECT in 2022 contract period with EOI but no confirmed partnership, where the 2024 LP is not available in 2025

School with an ECT in 2021 contract period & confirmed partnership, where the 2024 LP/DP is not available in 2025
School with an ECT in 2021 contract period with EOI but no confirmed partnership, where the 2024 LP is not available in 2025

@github-actions
Copy link

Review app deployed to https://cpd-ec2-review-2204-web.test.teacherservices.cloud

@ericaporter ericaporter marked this pull request as ready for review February 18, 2026 09:51
@@ -0,0 +1,11 @@
if Rails.env.staging? || Rails.env.development? || Rails.env.review?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update to if Rails.env.staging? before merging (otherwise can't test seeds)

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, do you know why we want different seeds on staging compared to review etc?

@sonarqubecloud
Copy link

Copy link
Contributor

@avinhurry avinhurry left a comment

Choose a reason for hiding this comment

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

Just a few comments/questions in line otherwise looks great.

teacher = FactoryBot.create(:teacher)

ect_period =
FactoryBot.create(
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are just create will re-running the seeds multiple times create duplicates, should we use find_or_create_by?

abp.body_type = "teaching_school_hub"
end

clear_attr!(abp, :dfe_sign_in_organisation_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intentional to clear the dfe_sign_in_organisation_id on Golden Leaf Teaching School Hub?

This record is used elsewhere in seeds. If it's only for reuse scenarios should we use one specifically for that instead?

@@ -0,0 +1,11 @@
if Rails.env.staging? || Rails.env.development? || Rails.env.review?
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, do you know why we want different seeds on staging compared to review etc?

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

Comments