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-3815] NPQ Post Separation Cleanup - Remove NPQ API disable feature flag from ECF #5372

27 changes: 0 additions & 27 deletions app/jobs/create_new_fake_sandbox_data_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,6 @@ def perform(provider_name: EDT_NAME)
)
end
end

if !NpqApiEndpoint.disabled? && npq_lead_provider.present? && random_school.present?
10.times do
name = Faker::Name.name
user = User.create!(full_name: name, email: Faker::Internet.email(name:))
identity = Identity::Create.call(user:, origin: :npq)
NPQApplication.create!(
active_alert: "",
date_of_birth: Date.new(1990, 1, 1),
eligible_for_funding: true,
funding_choice: "",
headteacher_status: "",
nino: "",
school_urn: random_school.urn,
teacher_reference_number: ValidTestDataGenerators::Helpers::TrnGenerator.next,
teacher_reference_number_verified: true,
npq_course: NPQCourse.all.sample,
npq_lead_provider:,
participant_identity: identity,
cohort: Cohort.active_registration_cohort,
)
end
end
end

private
Expand All @@ -50,10 +27,6 @@ def ecf_lead_provider
@ecf_lead_provider ||= LeadProvider.find_by(name: @provider_name)
end

def npq_lead_provider
@npq_lead_provider ||= NPQLeadProvider.find_by(name: @provider_name)
end

def random_school
@random_school ||= ecf_lead_provider.schools.sample
end
Expand Down
31 changes: 0 additions & 31 deletions app/jobs/npq/stream_big_query_enrollment_job.rb

This file was deleted.

38 changes: 0 additions & 38 deletions app/jobs/npq/stream_big_query_profile_job.rb

This file was deleted.

22 changes: 0 additions & 22 deletions app/jobs/participant_outcomes/batch_send_latest_outcomes_job.rb

This file was deleted.

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions app/jobs/participant_outcomes/stream_big_query_job.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/jobs/stream_big_query_participant_declarations_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def perform

return if table.nil?

scope = NpqApiEndpoint.disabled? ? ParticipantDeclaration::ECF : ParticipantDeclaration
scope
ParticipantDeclaration::ECF
.where(updated_at: 1.hour.ago.beginning_of_hour..1.hour.ago.end_of_hour)
.find_in_batches do |declarations|
rows = declarations.map do |participant_declaration|
Expand Down
8 changes: 0 additions & 8 deletions app/models/npq_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class NPQApplication < ApplicationRecord
belongs_to :cohort, optional: true
belongs_to :eligible_for_funding_updated_by, class_name: "User", optional: true

after_commit :push_enrollment_to_big_query

UK_CATCHMENT_AREA = %w[jersey_guernsey_isle_of_man england northern_ireland scotland wales].freeze

enum headteacher_status: {
Expand Down Expand Up @@ -164,12 +162,6 @@ def funding_eligibility(with_funded_place:)
eligible_for_funding && (funded_place.nil? || funded_place)
end

def push_enrollment_to_big_query
if (saved_changes.keys & %w[cohort_id id lead_provider_approval_status]).present?
NPQ::StreamBigQueryEnrollmentJob.perform_later(npq_application_id: id)
end
end

def validate_funding_eligiblity_status_code_change
if declared_as_billable? && eligible_for_funding == false
errors.add(:base, :billable_declaration_exists)
Expand Down
8 changes: 0 additions & 8 deletions app/models/participant_outcome/npq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class ParticipantOutcome::NPQ < ApplicationRecord
validates :state, presence: true
validates :completion_date, presence: true, future_date: true

after_commit :push_outcome_to_big_query

class << self
def latest
order(created_at: :desc).first
Expand Down Expand Up @@ -108,10 +106,4 @@ def latest_per_declaration?
def resend!
NPQ::ResendParticipantOutcome.new(participant_outcome_id: id).call
end

private

def push_outcome_to_big_query
ParticipantOutcomes::StreamBigQueryJob.perform_later(participant_outcome_id: id)
end
end
8 changes: 0 additions & 8 deletions app/models/participant_outcome_api_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@

class ParticipantOutcomeApiRequest < ApplicationRecord
belongs_to :participant_outcome, class_name: "ParticipantOutcome::NPQ"

after_commit :push_to_big_query

private

def push_to_big_query
ParticipantOutcomes::StreamApiRequestsToBigQueryJob.perform_later(participant_outcome_api_request_id: id)
end
end
8 changes: 0 additions & 8 deletions app/models/participant_profile/npq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class ParticipantProfile::NPQ < ParticipantProfile

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

after_commit :push_profile_to_big_query

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

def npq?
Expand Down Expand Up @@ -108,10 +106,4 @@ def role
# not sure what this should be but incase it's needed in the dashboard it won't break
"NPQ"
end

private

def push_profile_to_big_query
::NPQ::StreamBigQueryProfileJob.perform_later(profile_id: id)
end
end
1 change: 0 additions & 1 deletion app/services/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def feature
school_participant_status_language
npq_capping
registration_pilot_school
disable_npq
].freeze

FEATURES = (PERMANENT_SETTINGS + TEMPORARY_FEATURE_FLAGS).index_with { |name|
Expand Down
4 changes: 3 additions & 1 deletion app/services/record_declaration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,13 @@ def check_mentor_completion
end

def validate_if_npq_course_supported
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not want to keep this? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree to keep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will change this, i saw it on Leandro's PR👍

return unless NpqApiEndpoint.disabled?
return # TODO: should be fixed in https://github.com/DFE-Digital/early-careers-framework/pull/5371

# rubocop:disable Lint/UnreachableCode
if course_identifier.to_s.starts_with?("npq-")
errors.add(:course_identifier, I18n.t(:npq_course_no_longer_supported))
throw(:abort)
end
# rubocop:enable Lint/UnreachableCode
end
end
2 changes: 1 addition & 1 deletion app/services/statements/mark_as_paid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(statement)
end

def call
return if NpqApiEndpoint.disabled? && statement.npq?
return if statement.npq?

Finance::Statement.transaction do
participant_declarations.find_each do |participant_declaration|
Expand Down
2 changes: 1 addition & 1 deletion app/services/statements/mark_as_payable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(statement)
end

def call
return if NpqApiEndpoint.disabled? && statement.npq?
return if statement.npq?

Finance::Statement.transaction do
participant_declarations.find_each do |declaration|
Expand Down
3 changes: 0 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "npq_api_endpoint"

Rails.application.routes.draw do
mount_sidekiq = -> { mount Sidekiq::Web => "/sidekiq" }
authenticate(:user, :admin?.to_proc, &mount_sidekiq)
Expand Down Expand Up @@ -198,7 +196,6 @@
# Keeping the urls to old guidance urls, but they need to lead to new api-reference ones
get "/guidance/home", to: redirect("/api-reference")
get "/guidance/ecf-usage", to: redirect("/api-reference/ecf-usage")
Copy link
Contributor

Choose a reason for hiding this comment

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

A bunch of these other pages don't seem to exist either, we should maybe ditch the redirects at some point. There are also some translations we could bin here

https://github.com/DFE-Digital/early-careers-framework/blob/main/config/locales/en.yml#L600

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 let's keep the other redirects for now as not sure about those for now and they are not NPQ related.
In terms of other translations I think we need to do another sweep after those tickets to see whats left and break down into tickets to avoid too many changes

get "/guidance/npq-usage", to: redirect("/api-reference/npq-usage"), constraints: NpqApiEndpoint
get "/guidance/reference", to: redirect("/api-reference/reference")
get "/guidance/release-notes", to: redirect("/api-reference/release-notes")
get "/guidance/help", to: redirect("/api-reference/help")
Expand Down
4 changes: 0 additions & 4 deletions config/sidekiq_cron_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ remove_school_mentor_job:
cron: "45 4 * * *"
class: "RemoveSchoolMentorJob"
queue: default
send_outcomes_to_qualified_teachers_api:
cron: "*/10 * * * *"
class: "ParticipantOutcomes::BatchSendLatestOutcomesJob"
queue: participant_outcomes
build_completion_candidates_list_job:
cron: "15 23 * * 1,4"
class: "BuildCompletionCandidatesListJob"
Expand Down
11 changes: 0 additions & 11 deletions lib/npq_api_endpoint.rb

This file was deleted.

Loading
Loading