-
Notifications
You must be signed in to change notification settings - Fork 8
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
NPQ capping: add funded place to accept npq application endpoint #4726
NPQ capping: add funded place to accept npq application endpoint #4726
Conversation
Review app deployed to https://cpd-ecf-review-4726-web.test.teacherservices.cloud |
9f5645b
to
968e4d7
Compare
cc672ca
to
56fd640
Compare
app/models/npq_application.rb
Outdated
@@ -79,6 +79,14 @@ class NPQApplication < ApplicationRecord | |||
delegate :id, :name, to: :npq_course, prefix: true | |||
delegate :id, :name, to: :npq_lead_provider, prefix: true | |||
|
|||
def current_contract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contracts are provider specific, and tied to statements, we need to think about where we could query this, and if this should be on application or on the npq provider/statement instead, happy to chat through this
def funding_cap_available | ||
return unless FeatureFlag.active?("npq_capping") | ||
return if errors.any? | ||
return if funded_place.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if it actually should fail here since we are expecting it to be populated and not nil
?
|
||
return if funded_place && contract.funding_cap.present? && contract.funding_cap.positive? | ||
|
||
errors.add(:npq_application, I18n.t("npq_application.no_funding_cap_available")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe the check here will probably be that this field is required since there is a cap on the contract 🤔 otherwise it's ok?
context "when feature flag `npq_capping` is disabled" do | ||
before { FeatureFlag.deactivate(:npq_capping) } | ||
|
||
it "updates funded place attribute" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it "updates funded place attribute" do | |
it "does not update funded place attribute" do |
e2120c1
to
0df2ac1
Compare
13f1f44
to
07c5ca1
Compare
a6ecaac
to
0bb5bbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! just a minor comment around erroring if the request is not passed in
@@ -24,6 +27,9 @@ def call | |||
npq_application.update!(lead_provider_approval_status: "accepted") | |||
other_applications_in_same_cohort.update(lead_provider_approval_status: "rejected") # rubocop:disable Rails/SaveBang | |||
deduplicate_by_trn! | |||
if FeatureFlag.active?("npq_capping") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add the check that if funded place is set as well, incase it's in previous cohorts?
|
||
def accept_permitted_params | ||
params.require(:data).permit(:type, attributes: %i[funded_place]) | ||
rescue ActionController::ParameterMissing => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was testing with this and was thinking we avoid this because of past years where we won't need to pass in this request vs 2024, otherwise providers will get an error. Happy to chat through
0bb5bbb
to
70d0806
Compare
70d0806
to
cf1aa89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @mooktakim and @pmanrubia !
3277cc6
to
6bc9cea
Compare
6bc9cea
to
9c30630
Compare
Context
Updates
accept
end point for NPQ capping in all versions of the API.The code is behind the feature flag:
npq_capping
.Related PRs: #4690, #4697, #4701