Skip to content

Commit

Permalink
Actually fix the existing prod bug with makeDocumentDateLookupTable
Browse files Browse the repository at this point in the history
  • Loading branch information
haworku committed Apr 18, 2024
1 parent a36bf5a commit 8b8044b
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ function makeDocumentDateTable(
revisionsLookup: RevisionsLookupType
): DocumentDateLookupTableType {
const lookupTable: DocumentDateLookupTableType = {
previousSubmissionDate: null,
previousSubmissionDate: null, // the last time there was a submission on this package
}
Object.keys(revisionsLookup).forEach(
(revisionId: string, index: number) => {
const listOfRevisionLookups = Object.keys(revisionsLookup)
listOfRevisionLookups.forEach(
(revisionId: string, index) => {
const revision = revisionsLookup[revisionId]

const previousSubmission = getDateAdded(revision) // used in UploadedDocumentsTable to determine if we should show NEW tag
if (previousSubmission && !lookupTable['previousSubmissionDate'])
lookupTable['previousSubmissionDate'] = previousSubmission
const submitDate = revision.submitInfo?.updatedAt
if (submitDate && (listOfRevisionLookups.length === 1 || index === 1)) { // if we have a package with only one submitted revision, use that - otherwise use whatever in is the 1 index because thats the last submitted
lookupTable['previousSubmissionDate'] = submitDate
}

const allDocuments = getAllDocuments(revision.formData)
allDocuments.forEach((doc) => {
Expand Down

0 comments on commit 8b8044b

Please sign in to comment.