Skip to content

Commit

Permalink
update outdated error report language
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimpe committed Nov 5, 2024
1 parent 15dafb6 commit caf1c8a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hasReparsed,
getReprocessedDate,
downloadFile,
downloadErrorReport,
getErrorReportStatus,
} from './helpers'

const MonthSubRow = ({ data }) =>
Expand All @@ -26,32 +26,6 @@ const MonthSubRow = ({ data }) =>

const CaseAggregatesRow = ({ file }) => {
const dispatch = useDispatch()
const errorFileName = `${file.year}-${file.quarter}-${file.section}`

const getErrorReportStatus = () => {
if (
file.summary &&
file.summary.status &&
file.summary.status !== 'Pending'
) {
if (file.has_outdated_error_report) {
return 'Not Available'
} else if (file.hasError) {
return (
<button
className="section-download"
onClick={() => downloadErrorReport(file, errorFileName)}
>
{errorFileName}.xlsx
</button>
)
} else {
return 'No Errors'
}
} else {
return 'Pending'
}
}

return (
<>
Expand All @@ -67,10 +41,6 @@ const CaseAggregatesRow = ({ file }) => {
)}
</th>

<th scope="rowgroup" rowSpan={3}>
{hasReparsed(file) && formatDate(getReprocessedDate(file))}
</th>

<th scope="rowgroup" rowSpan={3}>
{file.submittedBy}
</th>
Expand Down Expand Up @@ -102,7 +72,7 @@ const CaseAggregatesRow = ({ file }) => {
</th>

<th scope="rowgroup" rowSpan={3}>
{getErrorReportStatus()}
{getErrorReportStatus(file)}
</th>
</tr>
<tr>
Expand All @@ -122,9 +92,6 @@ export const CaseAggregatesTable = ({ files }) => (
<th scope="col" rowSpan={2}>
Submitted On
</th>
<th scope="col" rowSpan={2}>
Reprocessed On
</th>
<th scope="col" rowSpan={2}>
Submitted By
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hasReparsed,
getReprocessedDate,
downloadFile,
downloadErrorReport,
getErrorReportStatus,
} from './helpers'

const MonthSubRow = ({ data }) =>
Expand All @@ -24,32 +24,6 @@ const MonthSubRow = ({ data }) =>

const TotalAggregatesRow = ({ file }) => {
const dispatch = useDispatch()
const errorFileName = `${file.year}-${file.quarter}-${file.section}`

const getErrorReportStatus = () => {
if (
file.summary &&
file.summary.status &&
file.summary.status !== 'Pending'
) {
if (file.has_outdated_error_report) {
return 'Not Available'
} else if (file.hasError) {
return (
<button
className="section-download"
onClick={() => downloadErrorReport(file, errorFileName)}
>
{errorFileName}.xlsx
</button>
)
} else {
return 'No Errors'
}
} else {
return 'Pending'
}
}

return (
<>
Expand All @@ -65,10 +39,6 @@ const TotalAggregatesRow = ({ file }) => {
)}
</th>

<th scope="rowgroup" rowSpan={3}>
{hasReparsed(file) && formatDate(getReprocessedDate(file))}
</th>

<th scope="rowgroup" rowSpan={3}>
{file.submittedBy}
</th>
Expand Down Expand Up @@ -96,7 +66,7 @@ const TotalAggregatesRow = ({ file }) => {
</th>

<th scope="rowgroup" rowSpan={3}>
{getErrorReportStatus()}
{getErrorReportStatus(file)}
</th>
</tr>
<tr>
Expand All @@ -116,9 +86,6 @@ export const TotalAggregatesTable = ({ files }) => (
<th scope="col" rowSpan={2}>
Submitted On
</th>
<th scope="col" rowSpan={2}>
Reprocessed On
</th>
<th scope="col" rowSpan={2}>
Submitted By
</th>
Expand Down
26 changes: 26 additions & 0 deletions tdrs-frontend/src/components/SubmissionHistory/helpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ export const hasReparsed = (f) =>

export const getReprocessedDate = (f) => f.reparse_file_metas[0].finished_at

export const getErrorReportStatus = (file) => {
if (
file.summary &&
file.summary.status &&
file.summary.status !== 'Pending'
) {
const errorFileName = `${file.year}-${file.quarter}-${file.section}`
if (file.has_outdated_error_report) {
return 'Unavailable, resubmit to view'
} else if (file.hasError) {
return (
<button
className="section-download"
onClick={() => downloadErrorReport(file, errorFileName)}
>
{errorFileName}.xlsx
</button>
)
} else {
return 'No Errors'
}
} else {
return 'Pending'
}
}

export const SubmissionSummaryStatusIcon = ({ status }) => {
let icon = null
let color = null
Expand Down

0 comments on commit caf1c8a

Please sign in to comment.