From 756e0294d4d71f93a7dadba8a13784d4a46548c7 Mon Sep 17 00:00:00 2001 From: Qin Date: Tue, 5 Nov 2024 10:07:20 -0800 Subject: [PATCH 1/4] handle more company types Signed-off-by: Qin --- legal-api/src/legal_api/models/filing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/legal-api/src/legal_api/models/filing.py b/legal-api/src/legal_api/models/filing.py index ee1295f18..a510c7681 100644 --- a/legal-api/src/legal_api/models/filing.py +++ b/legal-api/src/legal_api/models/filing.py @@ -742,7 +742,8 @@ def set_processed(self, business_type): def effective_date_can_be_before_payment_completion_date(self, business_type): """For AR or COD filings on CP or BEN then the effective date can be before the payment date.""" return self.filing_type in (Filing.FILINGS['annualReport'].get('name'), - Filing.FILINGS['changeOfDirectors'].get('name')) and business_type in {'CP', 'BEN'} + Filing.FILINGS['changeOfDirectors'].get('name')) and business_type in {'BEN','BC', + 'C', 'CBEN','CP', 'CUL', 'ULC', 'CC', 'CCC'} @staticmethod def _raise_default_lock_exception(): From 541dff8a58c47fafe4da34db3a5605817e28ef7a Mon Sep 17 00:00:00 2001 From: Qin Date: Tue, 5 Nov 2024 10:31:17 -0800 Subject: [PATCH 2/4] handle more company types 2 Signed-off-by: Qin --- legal-api/src/legal_api/models/filing.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/legal-api/src/legal_api/models/filing.py b/legal-api/src/legal_api/models/filing.py index a510c7681..8da1c160e 100644 --- a/legal-api/src/legal_api/models/filing.py +++ b/legal-api/src/legal_api/models/filing.py @@ -740,10 +740,9 @@ def set_processed(self, business_type): self.effective_date = self.payment_completion_date def effective_date_can_be_before_payment_completion_date(self, business_type): - """For AR or COD filings on CP or BEN then the effective date can be before the payment date.""" + """For AR or COD filings then the effective date can be before the payment date.""" return self.filing_type in (Filing.FILINGS['annualReport'].get('name'), - Filing.FILINGS['changeOfDirectors'].get('name')) and business_type in {'BEN','BC', - 'C', 'CBEN','CP', 'CUL', 'ULC', 'CC', 'CCC'} + Filing.FILINGS['changeOfDirectors'].get('name')) @staticmethod def _raise_default_lock_exception(): From d46f1d63d426cd239dd82a71ea80a765ab8de0e9 Mon Sep 17 00:00:00 2001 From: Qin Date: Tue, 5 Nov 2024 10:48:05 -0800 Subject: [PATCH 3/4] fix unit test Signed-off-by: Qin --- legal-api/tests/unit/core/test_filing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legal-api/tests/unit/core/test_filing.py b/legal-api/tests/unit/core/test_filing.py index 43fd16b09..090979ab1 100644 --- a/legal-api/tests/unit/core/test_filing.py +++ b/legal-api/tests/unit/core/test_filing.py @@ -179,9 +179,9 @@ def test_set_effective(session): filing.storage.set_processed(legal_type) - # assert that the effective date is the payment date + # assert that the effective date is now, instead of the payment date assert filing._storage.effective_date - assert filing._storage.effective_date.replace(tzinfo=None) == payment_date.replace(tzinfo=None) + assert filing._storage.effective_date.replace(tzinfo=None) == now.replace(tzinfo=None) assert not filing.is_future_effective future_date = now + datedelta.DAY From a142255acd8671fc663f43c8cba03ac1c76320d3 Mon Sep 17 00:00:00 2001 From: Qin Date: Tue, 5 Nov 2024 11:04:59 -0800 Subject: [PATCH 4/4] fix unit test 2 Signed-off-by: Qin --- legal-api/tests/unit/core/test_filing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/legal-api/tests/unit/core/test_filing.py b/legal-api/tests/unit/core/test_filing.py index 090979ab1..3b9266759 100644 --- a/legal-api/tests/unit/core/test_filing.py +++ b/legal-api/tests/unit/core/test_filing.py @@ -187,6 +187,7 @@ def test_set_effective(session): future_date = now + datedelta.DAY alt_payment_date = now filing._storage.skip_status_listener = True + filing._storage.effective_date = now + datedelta.DAY filing._storage.payment_completion_date = alt_payment_date filing._storage.save()