-
Notifications
You must be signed in to change notification settings - Fork 3
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
MR-2364: Dealt with packages with shared rates in the current UI #1945
MR-2364: Dealt with packages with shared rates in the current UI #1945
Conversation
…hanlding of no rate programs.
…mainModel. Update conversion functions to return error types.
…lue with formData id to pkg id.
…g errors in tests if programs are not found.
…shared-rates # Conflicts: # services/app-web/src/pages/StateSubmission/StateSubmissionForm.tsx # services/app-web/src/pages/SubmissionSideNav/SubmissionSideNav.tsx
contractsWithSharedRateRevision: { | ||
include: { | ||
revisions: { | ||
take: 1, |
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.
This looks fine to me based on the prisma table - to answer your question from the PR description. I think returning just latest rev for the linked contract makes sense.
I think it could be possible then we could display too early the updated programs from a rate that is unlocked and being edited by the state ...but I don't see a way around that since its a contract - rate revision relationship and not a contract revision - rate revision level relationship right now.
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.
LGTM - I think its a clever way to keep supporting this feature- watch out for interactions with #1903
…shared-rates # Conflicts: # services/app-api/prisma/schema.prisma # services/app-api/src/postgres/contractAndRates/parseContractWithHistory.ts # services/app-api/src/postgres/contractAndRates/parseRateWithHistory.ts # services/app-api/src/postgres/contractAndRates/prismaSharedContractRateHelpers.ts # services/app-api/src/postgres/contractAndRates/updateDraftContractWithRates.ts # services/app-api/src/resolvers/healthPlanPackage/submitHealthPlanPackage.test.ts # services/app-api/src/resolvers/healthPlanPackage/unlockHealthPlanPackage.test.ts # services/app-api/src/resolvers/healthPlanPackage/updateHealthPlanFormData.test.ts # services/app-api/src/testHelpers/contractAndRates/contractHelpers.ts # services/app-api/src/testHelpers/contractAndRates/rateHelpers.ts
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 don't love how much extra error handling we had to introduce here b/c we had to look up the package names. that will be nice to get into the db and no longer have to check in app space.
Nice work!
// We only care about the contract ID. PackageName is not in our DB, instead when converting DB data to domain | ||
// data we are generating the package name. | ||
const packagesWithSharedRateCerts = | ||
hppRateFormData.packagesWithSharedRateCerts?.reduce( |
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.
interesting use of reduce
, I feel like it might be clearer to chain a filter
and a map
, here
* Update packagesWithSharedRateCerts to contractsWithSharedRateRevision. * Refactor packageName parameters to only accept what is used and move hanlding of no rate programs. * Add real packagesWithSharedRateCerts data from db to rateFormDataToDomainModel. Update conversion functions to return error types. * Refactor variable sub with pkg for less confusion. Replace setting value with formData id to pkg id. * Replace using getProgramsFromState with findStatePrograms and throwing errors in tests if programs are not found. * Fix imports * Update contractsWithSharedRateRevision * Update tests for packages with shared rate certs. * cypress re-run * cypress re-run * Fix some merging stuff. * cypress re-run
Summary
MR-2364
packagesWithSharedRateCerts
tocontractsWithSharedRateRevision
.ContractTable
andRateRevisionTable
.SharedRateCertifications
join table.includeDraftRates
andsubincludeUpdateInfo
in the prisma helpers. AddedcontractsWithSharedRateRevision
that includes only the latest contract revision.createdAt
with the assumption that we don't care if its draft or submitted.updateDraftContractWithRates
just get an array of the contract ids andconnect
when creating a rate andset
when updating. using set here because we are only updating the relationship, no other complexity here unlike updating the rate revisions.rateFormDataToDomainModel
function now convertscontractsWithSharedRateRevision
from our DB to the domain modelpackagesWithSharedRateCerts
.contractsWithSharedRateRevision
and generates thepackageName
for each item.convertHealthPlanPackageRatesToDomain
will filter out anypackagesWithSharedRateCerts
that is missing apackageId
. I don't think it will ever happen, but it's here to satisfy the type and in case we overlooked anything.getProgramsFromState
used in tests. This is basically duplicate offindStatePrograms
but instead of returning an error, it will return an empty string. Not good for tests, because we should not expect to find no programs for a valid state.PackagesWithSharedRates.tsx
now uses the package level id instead of the form data level.useParams
was causing an eslint error. Updated the types to get rid of the error.packageName
has been refactored to take in arguments needed, instead of the entire package, for generating a name. Now, this can be used with new DB model contracts to generate the same name.generateRateName
Move defaulting to package programs into this function instead ofpackageName
.Related issues
Screenshots
Test cases covered
QA guidance