Skip to content

Commit

Permalink
Include REG_103 when setting current reg changePermit (#2033)
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Lovett <[email protected]>
  • Loading branch information
doug-lovett authored Oct 9, 2024
1 parent 7e70433 commit 1b55917
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mhr_api/src/mhr_api/models/registration_json_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def set_permit_json(registration, reg_json: dict) -> dict: # pylint: disable=to
expiry_ts = None
permit_status = None
permit_reg_id: int = 0
permit_doc_type: str = None
for reg in registration.change_registrations:
if reg.documents[0].document_type == MhrDocumentTypes.REG_103:
permit_number = reg.documents[0].document_registration_number
Expand All @@ -98,6 +99,7 @@ def set_permit_json(registration, reg_json: dict) -> dict: # pylint: disable=to
if reg.notes:
permit_status = reg.notes[0].status_type
expiry_ts = reg.notes[0].expiry_date
permit_doc_type = reg.documents[0].document_type
# current_app.logger.debug(f'set permit reg id {reg.id} set_permit status {permit_status}')
permit_reg_id = reg.id
if permit_number:
Expand All @@ -118,6 +120,7 @@ def set_permit_json(registration, reg_json: dict) -> dict: # pylint: disable=to
reg_json['permitLandStatusConfirmation'] = reg.draft.draft.get('landStatusConfirmation', False)
if 'permitLandStatusConfirmation' not in reg_json:
reg_json['permitLandStatusConfirmation'] = False
reg_json['permitExtended'] = permit_doc_type and permit_doc_type == MhrDocumentTypes.REG_103E
if permit_status and permit_status == MhrNoteStatusTypes.ACTIVE:
reg_json['previousLocation'] = get_permit_previous_location_json(registration)
return reg_json
Expand Down
4 changes: 3 additions & 1 deletion mhr_api/src/mhr_api/resources/v1/registrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ def get_change_permit(registration: MhrRegistration, account_id: str) -> bool:
can_edit: bool = False
if registration.change_registrations:
for reg in registration.change_registrations:
if reg.registration_type in (MhrRegistrationTypes.PERMIT, MhrRegistrationTypes.AMENDMENT):
if reg.registration_type in (MhrRegistrationTypes.PERMIT,
MhrRegistrationTypes.PERMIT_EXTENSION,
MhrRegistrationTypes.AMENDMENT):
if reg.notes and reg.notes[0].status_type == MhrNoteStatusTypes.ACTIVE and \
account_id == reg.account_id:
can_edit = True
Expand Down

0 comments on commit 1b55917

Please sign in to comment.