Skip to content

Commit

Permalink
skip unmigrated rates
Browse files Browse the repository at this point in the history
  • Loading branch information
mojotalantikite committed Apr 16, 2024
1 parent af49041 commit 745da54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,19 @@ function rateWithHistoryToDomainModel(
parentContractID = draftContract.contractID
} else {
// check the initial submission
if (submission.submittedContracts.length !== 1) {
const msg =
'programming error: its a submitted rate that was not submitted with a contract initially'
console.error(msg)
return new Error(msg)
if (firstRevision.relatedSubmissions.length == 0) {
console.info('No related submission. Unmigrated rate.')
parentContractID = '00000000-1111-2222-3333-444444444444'
} else {
if (submission.submittedContracts.length !== 1) {
const msg =
'programming error: its a submitted rate that was not submitted with a contract initially'
console.error(msg)
return new Error(msg)
}
const firstContract = submission.submittedContracts[0]
parentContractID = firstContract.contractID
}
const firstContract = submission.submittedContracts[0]
parentContractID = firstContract.contractID
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const includeFullRate = {
include: {
updatedBy: true,
submittedContracts: true,
}
},
},

contractRevisions: {
include: {
contractRevision: {
Expand All @@ -48,6 +48,7 @@ const includeFullRate = {
validAfter: 'asc',
},
},
relatedSubmissions: true,
},
},
} satisfies Prisma.RateTableInclude
Expand Down

0 comments on commit 745da54

Please sign in to comment.