Skip to content

Commit

Permalink
remove old submissions banner, column text, serializer data
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimpe committed Nov 8, 2024
1 parent 18d7363 commit d988e2d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 76 deletions.
30 changes: 6 additions & 24 deletions tdrs-backend/tdpservice/data_files/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class DataFileSerializer(serializers.ModelSerializer):
ssp = serializers.BooleanField(write_only=True)
has_error = serializers.SerializerMethodField()
summary = DataFileSummarySerializer(many=False, read_only=True)
reparse_file_metas = serializers.SerializerMethodField()
has_outdated_error_report = serializers.SerializerMethodField()
latest_reparse_file_meta = serializers.SerializerMethodField()

class Meta:
"""Metadata."""
Expand All @@ -69,8 +68,7 @@ class Meta:
's3_versioning_id',
'has_error',
'summary',
'reparse_file_metas',
'has_outdated_error_report',
'latest_reparse_file_meta',
]

read_only_fields = ("version",)
Expand All @@ -80,28 +78,12 @@ def get_has_error(self, obj):
parser_errors = ParserError.objects.filter(file=obj.id)
return len(parser_errors) > 0

def get_reparse_file_metas(self, instance):
def get_latest_reparse_file_meta(self, instance):
"""Return related reparse_file_metas, ordered by finished_at decending."""
reparse_file_metas = instance.reparse_file_metas.all().order_by('-finished_at')
return ReparseFileMetaSerializer(reparse_file_metas, many=True, read_only=True).data

def get_has_outdated_error_report(self, instance):
"""Return a boolean indicating whether the file's error report is outdated."""
original_submission_date = instance.created_at

cutoff_date = make_aware(settings.OUTDATED_SUBMISSION_CUTOFF)

if original_submission_date < cutoff_date:
reparse_file_metas = instance.reparse_file_metas.all().order_by('-finished_at')

if reparse_file_metas.count() > 0:
last_reparse_date = reparse_file_metas.first().finished_at
if last_reparse_date is None or last_reparse_date < cutoff_date:
return True

return True

return False
if reparse_file_metas.count() > 0:
return ReparseFileMetaSerializer(reparse_file_metas.first(), many=False, read_only=True).data
return None

def create(self, validated_data):
"""Create a new entry with a new version number."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,8 @@ const CaseAggregatesRow = ({ file }) => {
<>
<tr>
<th scope="rowgroup" rowSpan={3}>
{formatDate(file.createdAt)}
{hasReparsed(file) && (
<>
<br />
<br />
{'Reprocessed: ' + formatDate(getReprocessedDate(file))}
</>
)}
</th>

<th scope="rowgroup" rowSpan={3}>
{file.submittedBy}
{formatDate(file.createdAt) + ' by ' + file.submittedBy}
{hasReparsed(file) && <></>}
</th>

<th scope="rowgroup" rowSpan={3}>
Expand Down Expand Up @@ -92,9 +82,6 @@ export const CaseAggregatesTable = ({ files }) => (
<th scope="col" rowSpan={2}>
Submitted On
</th>
<th scope="col" rowSpan={2}>
Submitted By
</th>
<th scope="col" rowSpan={2}>
File Name
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,8 @@ const SubmissionHistory = ({ filterValues }) => {
}
}, [hasFetchedFiles, files, dispatch, filterValues])

const hasOutdatedSubmissions = () =>
files.some((element, index, array) => element.has_outdated_error_report)

return (
<>
{hasOutdatedSubmissions() && (
<div
className={classNames('usa-alert usa-alert--slim', {
[`usa-alert--info`]: true,
})}
>
<div className="usa-alert__body" role="alert">
<p className="usa-alert__text">
Please note that error reports and submission history content for
files submitted prior to May 31, 2024 may be outdated. Please
resubmit to get access to updated information.
</p>
</div>
</div>
)}

<div className="margin-top-2">
<a
className="usa-link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,8 @@ const TotalAggregatesRow = ({ file }) => {
<>
<tr>
<th scope="rowgroup" rowSpan={3}>
{formatDate(file.createdAt)}
{hasReparsed(file) && (
<>
<br />
<br />
{'Reprocessed: ' + formatDate(getReprocessedDate(file))}
</>
)}
</th>

<th scope="rowgroup" rowSpan={3}>
{file.submittedBy}
{formatDate(file.createdAt) + ' by ' + file.submittedBy}
{hasReparsed(file) && <></>}
</th>

<th scope="rowgroup" rowSpan={3}>
Expand Down Expand Up @@ -86,9 +76,6 @@ export const TotalAggregatesTable = ({ files }) => (
<th scope="col" rowSpan={2}>
Submitted On
</th>
<th scope="col" rowSpan={2}>
Submitted By
</th>
<th scope="col" rowSpan={2}>
File Name
</th>
Expand Down
4 changes: 1 addition & 3 deletions tdrs-frontend/src/components/SubmissionHistory/helpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export const getErrorReportStatus = (file) => {
file.summary.status !== 'Pending'
) {
const errorFileName = `${file.year}-${file.quarter}-${file.section}`
if (file.has_outdated_error_report) {
return 'This file was submitted prior to May 31, 2024. Please resubmit to get access to updated information.'
} else if (file.hasError) {
if (file.hasError) {
return (
<button
className="section-download"
Expand Down

0 comments on commit d988e2d

Please sign in to comment.