Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19794 fixes #2850

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion colin-api/src/colin_api/resources/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def get(info_type, legal_type=None, identifier=None): # pylint: disable = too-m
if not json_data or not json_data['identifiers']:
return jsonify({'message': 'No input data provided'}), HTTPStatus.BAD_REQUEST
# remove the BC prefix
identifiers = [x[-7:] if identifier.startswith('BC') else x
identifiers = [x[-7:] if x.startswith('BC') else x
for x in json_data['identifiers']]
bn_15s = Business._get_bn_15s( # pylint: disable = protected-access; internal call
cursor=cursor,
Expand Down
11 changes: 7 additions & 4 deletions jobs/update-colin-filings/update_colin_filings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
This module is the API for the Legal Entity system.
"""
import logging
import math
import os

import requests
Expand Down Expand Up @@ -134,11 +135,12 @@ def run():
token = AccountService.get_bearer_token()

page = 1
total_pages = None
while ((total_pages is None or page <= total_pages) and
(results := get_filings(application, token, page, 50))):
limit = 50
pending_filings = None
while ((pending_filings is None or page <= math.ceil(pending_filings/limit)) and
(results := get_filings(application, token, page, limit))):
page += 1
total_pages = results.get('pages')
pending_filings = results.get('total')
if not (filings := results.get('filings')):
# pylint: disable=no-member; false positive
application.logger.debug('No completed filings to send to colin.')
Expand All @@ -158,6 +160,7 @@ def run():
if update:
# pylint: disable=no-member; false positive
application.logger.debug(f'Successfully updated filing {filing_id}')
pending_filings -= 1
else:
corps_with_failed_filing.append(filing['filing']['business']['identifier'])
# pylint: disable=no-member; false positive
Expand Down
Loading