Skip to content

Commit

Permalink
[CPDLP-3094] Rollback contracts stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroalemao committed Jul 4, 2024
1 parent b907847 commit bdfa479
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 290 deletions.
4 changes: 0 additions & 4 deletions app/models/contract.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/services/declarations/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class Create
validates :declaration_date, declaration_date: true
validates :declaration_date, presence: true
validates :declaration_type, presence: true
# TODO we don't have NPQ Contract yet
validates :cohort, contract_for_cohort_and_course: true
# TODO: we don't have NPQ Contract yet
# validates :cohort, contract_for_cohort_and_course: true

validate :output_fee_statement_available
validate :validate_has_passed_field, if: :validate_has_passed?
Expand Down
29 changes: 0 additions & 29 deletions app/validators/contract_for_cohort_and_course_validator.rb

This file was deleted.

2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ en:
blank: "Enter a '#/declaration_type'."
has_passed:
invalid: "Enter 'true' or 'false' in the '#/has_passed' field to indicate whether this participant has passed or failed their course."
cohort:
missing_npq_contract_for_cohort_and_course: You cannot change a participant to this cohort as you do not have a contract for the cohort and course. Contact the DfE for assistance.
course_identifier:
invalid_course: "The entered '#/course_identifier' is not recognised for the given participant. Check details and try again."

Expand Down
19 changes: 0 additions & 19 deletions db/migrate/20240624112305_create_contracts.rb

This file was deleted.

20 changes: 0 additions & 20 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,6 @@
t.index ["start_year"], name: "index_cohorts_on_start_year", unique: true
end

create_table "contracts", force: :cascade do |t|
t.bigint "statement_id", null: false
t.bigint "course_id", null: false
t.integer "recruitment_target", null: false
t.decimal "per_participant", null: false
t.integer "number_of_payment_periods", null: false
t.integer "output_payment_percentage", default: 60, null: false
t.integer "service_fee_installments", null: false
t.integer "service_fee_percentage", default: 40, null: false
t.decimal "monthly_service_fee", default: "0.0"
t.decimal "targeted_delivery_funding_per_participant", default: "100.0"
t.boolean "special_course", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["course_id"], name: "index_contracts_on_course_id"
t.index ["statement_id"], name: "index_contracts_on_statement_id"
end

create_table "course_groups", force: :cascade do |t|
t.string "name", null: false
t.datetime "created_at", null: false
Expand Down Expand Up @@ -502,8 +484,6 @@
add_foreign_key "applications", "schedules"
add_foreign_key "applications", "schools"
add_foreign_key "applications", "users"
add_foreign_key "contracts", "courses"
add_foreign_key "contracts", "statements"
add_foreign_key "courses", "course_groups"
add_foreign_key "declarations", "applications"
add_foreign_key "declarations", "cohorts"
Expand Down
1 change: 0 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def load_base_file(file)
"add_lead_providers.rb",
"add_itt_providers.rb",
"add_statements.rb",
"add_contracts.rb",
"add_users.rb",
"add_applications.rb",
"add_settings.rb",
Expand Down
9 changes: 0 additions & 9 deletions db/seeds/base/add_contracts.rb

This file was deleted.

115 changes: 0 additions & 115 deletions spec/factories/contract.rb

This file was deleted.

8 changes: 0 additions & 8 deletions spec/models/contract_spec.rb

This file was deleted.

2 changes: 0 additions & 2 deletions spec/requests/api/v1/declarations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def path(id = nil)
let(:resource_id) { resource.ecf_id }
let(:resource_name) { :declaration }

before { create(:contract, course:, cohort:, lead_provider:) }

it_behaves_like "an API create endpoint"
end
end
2 changes: 0 additions & 2 deletions spec/requests/api/v2/declarations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def path(id = nil)
let(:resource_id) { resource.ecf_id }
let(:resource_name) { :declaration }

before { create(:contract, course:, cohort:, lead_provider:) }

it_behaves_like "an API create endpoint"
end
end
2 changes: 0 additions & 2 deletions spec/requests/api/v3/declarations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def path(id = nil)
let(:resource_id) { resource.ecf_id }
let(:resource_name) { :declaration }

before { create(:contract, course:, cohort:, lead_provider:) }

it_behaves_like "an API create endpoint"
end
end
11 changes: 1 addition & 10 deletions spec/services/declarations/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
has_passed:,
}
end
let!(:contract) { create(:contract, course:, cohort:, lead_provider:) }
let!(:statement) { create(:statement, cohort:, lead_provider:) }

subject(:service) { described_class.new(**params) }

Expand Down Expand Up @@ -147,15 +147,6 @@
end
end

context "when there is no contract for cohort & course" do
before { contract.update!(course: Course.all.excluding(course).sample) }

it "returns error" do
expect(service).to be_invalid
expect(service.errors.first).to have_attributes(attribute: :cohort, type: :missing_npq_contract_for_cohort_and_course)
end
end

context "when there are no available output fee statements" do
before { lead_provider.next_output_fee_statement(cohort).update!(output_fee: false) }

Expand Down
65 changes: 0 additions & 65 deletions spec/validators/contract_for_cohort_and_course_validator_spec.rb

This file was deleted.

0 comments on commit bdfa479

Please sign in to comment.