Skip to content

Commit

Permalink
Merge branch 'develop' into sprint-93-summary
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermb authored Feb 28, 2024
2 parents 8744091 + c8d0934 commit 356156e
Show file tree
Hide file tree
Showing 9 changed files with 629 additions and 322 deletions.
25 changes: 25 additions & 0 deletions tdrs-backend/tdpservice/parsers/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,28 @@ def case_aggregates_by_month(df, dfs_status):
aggregate_data['rejected'] = ParserError.objects.filter(file=df).filter(case_number=None).count()

return aggregate_data


def total_errors_by_month(df, dfs_status):
"""Return total errors for each month in the reporting period."""
calendar_year, calendar_qtr = fiscal_to_calendar(df.year, df.quarter)
month_list = transform_to_months(calendar_qtr)

total_errors_data = {"months": []}

errors = ParserError.objects.all().filter(file=df)

for month in month_list:
if dfs_status == "Rejected":
total_errors_data["months"].append(
{"month": month, "total_errors": "N/A"})
continue

month_int = month_to_int(month)
rpt_month_year = int(f"{calendar_year}{month_int}")

error_count = errors.filter(rpt_month_year=rpt_month_year).count()
total_errors_data["months"].append(
{"month": month, "total_errors": error_count})

return total_errors_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HEADER20204S06 TAN1 N
T720204700006853700680540068454103000312400000000003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
Loading

0 comments on commit 356156e

Please sign in to comment.