Skip to content

Commit 7282beb

Browse files
32158 next annual report date fix (#4020)
1 parent 8eb27ef commit 7282beb

17 files changed

Lines changed: 88 additions & 218 deletions

File tree

legal-api/src/legal_api/models/business.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ def business_legal_name(self):
336336
def next_anniversary(self):
337337
"""Retrieve the next anniversary date for which an AR filing is due."""
338338
_founding_date = LegislationDatetime.as_legislation_timezone(self.founding_date)
339-
next_ar_year = (self.last_ar_year if self.last_ar_year else self.founding_date.year) + 1
339+
next_ar_year = (self.last_ar_year if self.last_ar_year else _founding_date.year) + 1
340340
no_of_years_to_add = next_ar_year - _founding_date.year
341-
return _founding_date + datedelta.datedelta(years=no_of_years_to_add)
341+
return LegislationDatetime.as_utc_timezone(_founding_date + datedelta.datedelta(years=no_of_years_to_add))
342342

343343
@property
344344
def next_annual_tr_due_datetime(self) -> datetime:

legal-api/tests/unit/models/test_business.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def test_business_json(session):
359359
'naicsKey': None,
360360
'naicsCode': None,
361361
'naicsDescription': None,
362-
'nextAnnualReport': '1971-12-31T16:00:00-08:00',
362+
'nextAnnualReport': '1971-01-01T00:00:00+00:00',
363363
'hasRestrictions': True,
364364
'arMinDate': '1971-01-01',
365365
'arMaxDate': '1972-04-30',

legal-api/tests/unit/resources/v2/test_business_filings/test_filings.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ def test_post_only_validate_ar(session, client, jwt):
496496

497497
ar = copy.deepcopy(ANNUAL_REPORT)
498498
annual_report_date = datetime(datetime.utcnow().year, 2, 20).date()
499-
if annual_report_date > datetime.utcnow().date():
500-
annual_report_date = datetime.utcnow().date()
499+
if annual_report_date > LegislationDatetime.now().date():
500+
annual_report_date = LegislationDatetime.now().date()
501501
ar['filing']['annualReport']['annualReportDate'] = annual_report_date.isoformat()
502502
ar['filing']['annualReport']['annualGeneralMeetingDate'] = datetime.utcnow().date().isoformat()
503503

@@ -519,8 +519,8 @@ def test_post_validate_ar_using_last_ar_date(session, client, jwt):
519519
)
520520
ar = copy.deepcopy(ANNUAL_REPORT)
521521
annual_report_date = datetime(datetime.utcnow().year, 2, 20).date()
522-
if annual_report_date > datetime.utcnow().date():
523-
annual_report_date = datetime.utcnow().date()
522+
if annual_report_date > LegislationDatetime.now().date():
523+
annual_report_date = LegislationDatetime.now().date()
524524
ar['filing']['annualReport']['annualReportDate'] = annual_report_date.isoformat()
525525
ar['filing']['annualReport']['annualGeneralMeetingDate'] = datetime.utcnow().date().isoformat()
526526

@@ -590,8 +590,8 @@ def test_post_validate_ar_valid_routing_slip(session, client, jwt):
590590

591591
ar = copy.deepcopy(ANNUAL_REPORT)
592592
annual_report_date = datetime(datetime.utcnow().year, 2, 20).date()
593-
if annual_report_date > datetime.utcnow().date():
594-
annual_report_date = datetime.utcnow().date()
593+
if annual_report_date > LegislationDatetime.now().date():
594+
annual_report_date = LegislationDatetime.now().date()
595595
ar['filing']['annualReport']['annualReportDate'] = annual_report_date.isoformat()
596596
ar['filing']['annualReport']['annualGeneralMeetingDate'] = datetime.utcnow().date().isoformat()
597597
ar['filing']['header']['routingSlipNumber'] = '123131332'
@@ -743,8 +743,8 @@ def test_post_valid_ar_failed_payment(monkeypatch, session, client, jwt):
743743
factory_business_mailing_address(business)
744744
ar = copy.deepcopy(ANNUAL_REPORT)
745745
annual_report_date = datetime(datetime.utcnow().year, 2, 20).date()
746-
if annual_report_date > datetime.utcnow().date():
747-
annual_report_date = datetime.utcnow().date()
746+
if annual_report_date > LegislationDatetime.now().date():
747+
annual_report_date = LegislationDatetime.now().date()
748748
ar['filing']['annualReport']['annualReportDate'] = annual_report_date.isoformat()
749749
ar['filing']['annualReport']['annualGeneralMeetingDate'] = datetime.utcnow().date().isoformat()
750750
ar['filing']['business']['identifier'] = 'CP7654321'
@@ -1256,8 +1256,8 @@ def test_file_ar_no_agm_coop(session, client, jwt):
12561256
factory_business_mailing_address(business)
12571257
ar = copy.deepcopy(ANNUAL_REPORT)
12581258
annual_report_date = datetime(datetime.utcnow().year, 2, 20).date()
1259-
if annual_report_date > datetime.utcnow().date():
1260-
annual_report_date = datetime.utcnow().date()
1259+
if annual_report_date > LegislationDatetime.now().date():
1260+
annual_report_date = LegislationDatetime.now().date()
12611261
ar['filing']['annualReport']['annualReportDate'] = annual_report_date.isoformat()
12621262
ar['filing']['header']['date'] = datetime.utcnow().date().isoformat()
12631263
ar['filing']['annualReport']['annualGeneralMeetingDate'] = None

python/common/business-registry-model/.devcontainer/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
FROM mcr.microsoft.com/devcontainers/python:1-3.11-bookworm
1+
FROM mcr.microsoft.com/devcontainers/python:dev-3.13-bookworm
22

33

44
RUN \
5+
rm -f /etc/apt/sources.list.d/yarn.list && \
56
apt update && apt install bash-completion -y && \
67
pip install pre-commit && \
78
curl -sSL https://install.python-poetry.org | POETRY_HOME=/home/vscode/.local python3 -
@@ -19,4 +20,4 @@ RUN \
1920
echo ' . /etc/bash_completion' >> /home/vscode/.bashrc && \
2021
echo 'fi' >> /home/vscode/.bashrc && \
2122
echo >> /home/vscode/.bashrc && \
22-
echo '. <(poetry completions)' >> /home/vscode/.bashrc
23+
echo '. <(poetry completions)' >> /home/vscode/.bashrc

python/common/business-registry-model/poetry.lock

Lines changed: 12 additions & 137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/common/business-registry-model/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[project]
22
name = "business-model"
3-
version = "3.3.15"
3+
version = "3.3.16"
44
description = ""
55
authors = [
66
{name = "thor",email = "1042854+thorwolpert@users.noreply.github.com"}
77
]
88
readme = "README.md"
9-
requires-python = ">=3.9,<4"
9+
requires-python = ">=3.13,<3.14"
1010
dependencies = [
1111
"sql-versioning @ git+https://github.com/bcgov/lear.git@main#subdirectory=python/common/sql-versioning-alt",
1212
"registry-schemas @ git+https://github.com/bcgov/business-schemas.git@2.18.56",

0 commit comments

Comments
 (0)