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

NPQ capping: add funded place to accept npq application endpoint #4726

Conversation

pmanrubia
Copy link
Contributor

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

Copy link

Review app deployed to https://cpd-ecf-review-4726-web.test.teacherservices.cloud

@pmanrubia pmanrubia force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 9f5645b to 968e4d7 Compare April 25, 2024 05:21
@pmanrubia pmanrubia force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from cc672ca to 56fd640 Compare April 29, 2024 05:17
@@ -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
Copy link
Collaborator

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?
Copy link
Collaborator

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"))
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 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it "updates funded place attribute" do
it "does not update funded place attribute" do

@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from e2120c1 to 0df2ac1 Compare May 9, 2024 15:54
@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 13f1f44 to 07c5ca1 Compare May 9, 2024 17:57
@mooktakim mooktakim requested a review from cwrw May 10, 2024 09:07
@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from a6ecaac to 0bb5bbb Compare May 10, 2024 11:15
Copy link
Collaborator

@cwrw cwrw left a 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")
Copy link
Collaborator

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
Copy link
Collaborator

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

@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 0bb5bbb to 70d0806 Compare May 13, 2024 14:10
@mooktakim mooktakim requested a review from cwrw May 13, 2024 14:14
@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 70d0806 to cf1aa89 Compare May 13, 2024 14:15
Copy link
Collaborator

@cwrw cwrw left a 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 !

@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 3277cc6 to 6bc9cea Compare May 16, 2024 11:26
@mooktakim mooktakim force-pushed the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch from 6bc9cea to 9c30630 Compare May 16, 2024 13:49
@mooktakim mooktakim added this pull request to the merge queue May 17, 2024
Merged via the queue into main with commit 72f36db May 17, 2024
37 checks passed
@mooktakim mooktakim deleted the CPDLP-2938-npq-capping-add-funded-place-to-accept-npq-application-endpoint branch May 17, 2024 09:22
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.

None yet

3 participants