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

[CPDLP-3818] Remove data in shared ecf declaration tables for npq #5401

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion app/controllers/api/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class ApiController < ActionController::API
rescue_from ActiveRecord::RecordNotUnique, with: :bad_request_response
rescue_from ActiveRecord::RecordInvalid, with: :invalid_transition
rescue_from Api::Errors::InvalidTransitionError, with: :invalid_transition
rescue_from Api::Errors::InvalidParticipantOutcomeError, with: :invalid_transition
rescue_from Api::Errors::InvalidDatetimeError, with: :invalid_updated_since_response
rescue_from Api::Errors::InvalidTrainingStatusError, with: :invalid_training_status_response
rescue_from Pagy::VariableError, with: :invalid_pagination_response
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion app/jobs/detect_sidekiq_metrics_issues_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class DetectSidekiqMetricsIssuesJob
include Sidekiq::Worker

SIDEKIQ_QUEUE_NAMES = %w[priority_mailers mailers default participant_outcomes big_query].freeze
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can remove outcomes from fixtures? fixtures/files/api_reference/api_spec.json

SIDEKIQ_QUEUE_NAMES = %w[priority_mailers mailers default big_query].freeze
SIDEKIQ_RETRIES_THRESHOLD = 200
SIDEKIQ_LATENCY_THRESHOLD = 120

Expand Down
1 change: 0 additions & 1 deletion app/models/participant_declaration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,3 @@ def build_initial_declaration_state
end

require "participant_declaration/ecf"
require "participant_declaration/npq"
71 changes: 0 additions & 71 deletions app/models/participant_declaration/npq.rb

This file was deleted.

19 changes: 0 additions & 19 deletions app/models/participant_outcome/npq.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/models/participant_outcome_api_request.rb

This file was deleted.

7 changes: 4 additions & 3 deletions app/models/participant_profile/npq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class ParticipantProfile::NPQ < ParticipantProfile
# self.ignored_columns = %i[mentor_profile_id school_cohort_id]
belongs_to :cohort, optional: true
belongs_to :school, optional: true
belongs_to :npq_course, optional: true

has_many :participant_declarations, class_name: "ParticipantDeclaration::NPQ", foreign_key: :participant_profile_id

self.validation_steps = %i[identity decision].freeze

Expand All @@ -68,6 +65,10 @@ def participant_type
:npq
end

def fundable?
nil
end

def schedule_for(*)
schedule
end
Expand Down
2 changes: 1 addition & 1 deletion app/validators/future_date_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class FutureDateValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if value && value > Time.zone.now
record.instance_of?(::ParticipantOutcome::NPQ) ? record.errors.add(attribute, I18n.t(:future_date_outcomes, attribute:)) : record.errors.add(attribute, I18n.t(:future_date, attribute:))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop future_date_outcomes from the translations file

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think those are in the sweep later so its ok :)

record.errors.add(attribute, I18n.t(:future_date, attribute:))
end
end
end
20 changes: 0 additions & 20 deletions config/analytics.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
---
:shared:
:participant_outcomes:
- id
- state
- completion_date
- participant_declaration_id
- created_at
- updated_at
- qualified_teachers_api_request_successful
- sent_to_qualified_teachers_api_at
:school_cohorts:
- id
- induction_programme_choice
Expand Down Expand Up @@ -62,17 +53,6 @@
- pending
- report_id
- relationship
:participant_outcome_api_requests:
- id
- request_path
- status_code
- request_headers
- request_body
- response_body
- response_headers
- participant_outcome_id
- created_at
- updated_at
:participant_declarations:
- id
- declaration_type
Expand Down
1 change: 0 additions & 1 deletion config/sidekiq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- priority_mailers
- mailers
- default
- participant_outcomes
- big_query
- dfe_analytics
- slack_alerts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

class DropTableParticipantOutcomeApiRequests < ActiveRecord::Migration[7.1]
def up
drop_table :participant_outcome_api_requests
end

def down
create_table :participant_outcome_api_requests, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :request_path
t.integer :status_code
t.jsonb :request_headers
t.jsonb :request_body
t.jsonb :response_body
t.jsonb :response_headers
t.uuid :participant_outcome_id, null: false
t.datetime :created_at, null: false
t.datetime :updated_at, null: false

t.index :participant_outcome_id, name: "index_participant_outcome_api_requests_on_participant_outcome"
end
end
end
24 changes: 24 additions & 0 deletions db/migrate/20250103133758_drop_table_participant_outcomes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

class DropTableParticipantOutcomes < ActiveRecord::Migration[7.1]
def up
drop_table :participant_outcomes
end

def down
create_table :participant_outcomes, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.string :state, null: false
t.date :completion_date, null: false
t.uuid :participant_declaration_id, null: false
t.datetime :created_at, null: false
t.datetime :updated_at, null: false
t.boolean :qualified_teachers_api_request_successful
t.datetime :sent_to_qualified_teachers_api_at

t.index :created_at, name: "index_participant_outcomes_on_created_at"
t.index :participant_declaration_id, name: "index_declaration"
t.index :sent_to_qualified_teachers_api_at, name: "index_participant_outcomes_on_sent_to_qualified_teachers_api_at"
t.index :state, name: "index_participant_outcomes_on_state"
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20250103422828_delete_npq_declarations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class DeleteNPQDeclarations < ActiveRecord::Migration[7.1]
def up
npq_type = "ParticipantDeclaration::NPQ"

DeclarationState.includes(:participant_declaration).where(participant_declaration: { type: npq_type } ).delete_all
ParticipantDeclarationAttempt.includes(:participant_declaration).where(participant_declaration: { type: npq_type } ).delete_all
ParticipantDeclaration.where(type: npq_type).delete_all
end
end
29 changes: 0 additions & 29 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -777,33 +777,6 @@
t.index ["user_id"], name: "index_participant_identities_on_user_id"
end

create_table "participant_outcome_api_requests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "request_path"
t.integer "status_code"
t.jsonb "request_headers"
t.jsonb "request_body"
t.jsonb "response_body"
t.jsonb "response_headers"
t.uuid "participant_outcome_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["participant_outcome_id"], name: "index_participant_outcome_api_requests_on_participant_outcome"
end

create_table "participant_outcomes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "state", null: false
t.date "completion_date", null: false
t.uuid "participant_declaration_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "qualified_teachers_api_request_successful"
t.datetime "sent_to_qualified_teachers_api_at", precision: nil
t.index ["created_at"], name: "index_participant_outcomes_on_created_at"
t.index ["participant_declaration_id"], name: "index_declaration"
t.index ["sent_to_qualified_teachers_api_at"], name: "index_participant_outcomes_on_sent_to_qualified_teachers_api_at"
t.index ["state"], name: "index_participant_outcomes_on_state"
end

create_table "participant_profile_completion_date_inconsistencies", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "participant_profile_id", null: false
t.date "dqt_value"
Expand Down Expand Up @@ -1253,8 +1226,6 @@
add_foreign_key "participant_declarations", "users", column: "mentor_user_id"
add_foreign_key "participant_id_changes", "users"
add_foreign_key "participant_identities", "users"
add_foreign_key "participant_outcome_api_requests", "participant_outcomes"
add_foreign_key "participant_outcomes", "participant_declarations"
add_foreign_key "participant_profile_completion_date_inconsistencies", "participant_profiles"
add_foreign_key "participant_profile_schedules", "participant_profiles"
add_foreign_key "participant_profile_schedules", "schedules"
Expand Down
44 changes: 0 additions & 44 deletions spec/factories/participant_outcome_api_request.rb

This file was deleted.

40 changes: 0 additions & 40 deletions spec/factories/participant_outcome_npq.rb

This file was deleted.

Loading
Loading