-
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
Consolidate contract and rate types #1872
Conversation
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.
Thank you! I would love to get this merged and work on top of this code.
@@ -74,6 +74,11 @@ function convertContractToUnlockedHealthPlanPackage( | |||
): HealthPlanPackageType | Error { | |||
console.info('Attempting to convert contract to health plan package') | |||
|
|||
// Since drafts come in separate on the Contract type, we push it onto the revisions before converting below | |||
if (contract.draftRevision) { | |||
contract.revisions.unshift(contract.draftRevision) |
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.
🔴 should we do anything else to verify that the first revision is indeed a draft here or can we be confident?
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 we're good here, a draft should be a draft if we put it on draftRevision
if (!rateRev.submitInfo) { | ||
if (draftRevision) { | ||
return new Error( | ||
'PROGRAMMING ERROR: a contract may not have multiple drafts simultaneously. ID: ' + |
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.
'PROGRAMMING ERROR: a contract may not have multiple drafts simultaneously. ID: ' + | |
'PROGRAMMING ERROR: a rate may not have multiple drafts simultaneously. ID: ' + |
const rateRevisions = rate.revisions | ||
let draftRevision: RateRevisionWithContractsType | undefined = undefined | ||
for (const rateRev of rateRevisions) { | ||
// no drafts allowed |
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.
// no drafts allowed | |
// We have already set the draft revision aside, all ordered revisions here should be submitted |
draftContracts: DraftContractsTable[] | ||
): ContractRevisionType[] { | ||
return draftContracts.map((dc) => | ||
contractRevisionToDomainModel(dc.revisions[0]) |
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.
Nice this is good - I like this way of making sure we only grab the first by putting it just at the level of the domain transform function
Summary
This PR updates all the Rate types to match the Contract types and gets rid of the separate Draft types for both.
All of our contract and rate functions can now return this full table type.
I think some of the files could be consolidated now but I messed it up on my first try so I scrapped that for today.
Related issues
Screenshots
Test cases covered
QA guidance