Skip to content

Refactor: Improve handling activity date#44

Merged
schbetsy merged 4 commits intomainfrom
date-sub
Mar 23, 2026
Merged

Refactor: Improve handling activity date#44
schbetsy merged 4 commits intomainfrom
date-sub

Conversation

@schbetsy
Copy link
Copy Markdown
Collaborator

Minor improvement to the way we assign date values in the parser.

Changes

  • Make activity_date a property of the parser object. A new parser object is created for each M2 file, and the Activity Date value applies to all records in a Metro2 file, so no specificity is lost.
  • Add type hints for methods that return date values
  • Move code that handles assigning activity date from the parser to the AccountActivity model. This is the logic that checks whether activity_date has a value (it doesn't when the header segment is missing) and assigns DOAI as activity date when it is missing.

Testing

  1. python manage.py test

Assigning DOAI as activity date is tested in test_parser.py by the test called test_parse_file_without_header_line.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated
  • Reviewers requested with the Reviewers tool ➡️

Copy link
Copy Markdown
Member

@willbarton willbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me 👍🏻

@schbetsy schbetsy merged commit 05f9c31 into main Mar 23, 2026
1 check passed
@schbetsy schbetsy deleted the date-sub branch March 23, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants