Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantPhour committed Oct 10, 2024
2 parents fa8b73e + 23d4556 commit 4dcefaa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions mooringlicensing/components/main/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,41 @@ def retrieve_mooring_areas():
orig_mo = deepcopy(mo)
mo.mooring_bookings_id=mooring.get("id")
mo.name=mooring.get("name")
mo.mooring_bay = MooringBay.objects.get(
mooring_bookings_id=mooring.get('marine_park_id'),
try:
mo.mooring_bay = MooringBay.objects.get(
mooring_bookings_id=mooring.get('marine_park_id'),
active=True
)
)
except:
continue
mo.vessel_size_limit = mooring.get('vessel_size_limit')
mo.vessel_draft_limit = mooring.get('vessel_draft_limit')
mo.vessel_beam_limit = mooring.get('vessel_beam_limit')
mo.vessel_weight_limit = mooring.get('vessel_weight_limit')
mo.mooring_bookings_mooring_specification = mooring.get('mooring_specification')
mo.mooring_bookings_bay_id = mooring.get('marine_park_id')
mo.save()
if orig_mo != mo:

if (float(mo.vessel_size_limit) != float(orig_mo.vessel_size_limit) or
float(mo.vessel_draft_limit) != float(orig_mo.vessel_draft_limit) or
float(mo.vessel_beam_limit) != float(orig_mo.vessel_beam_limit) or
float(mo.vessel_weight_limit) != float(orig_mo.vessel_weight_limit) or
float(mo.mooring_bookings_mooring_specification) != float(orig_mo.mooring_bookings_mooring_specification) or
float(mo.mooring_bookings_bay_id) != float(orig_mo.mooring_bookings_bay_id)):
records_updated.append(str(mo.name))
else:
try:
mooring_bay = MooringBay.objects.get(
mooring_bookings_id=mooring.get('marine_park_id'),
active=True
)
except:
continue

mooring = Mooring.objects.create(
mooring_bookings_id=mooring.get("id"),
name=mooring.get("name"),
mooring_bay = MooringBay.objects.get(
mooring_bookings_id=mooring.get('marine_park_id'),
active=True
),
mooring_bay = mooring_bay,
vessel_size_limit = mooring.get('vessel_size_limit'),
vessel_draft_limit = mooring.get('vessel_draft_limit'),
vessel_beam_limit = mooring.get('vessel_beam_limit'),
Expand Down
2 changes: 1 addition & 1 deletion mooringlicensing/components/proposals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5754,7 +5754,7 @@ class Meta:
reversion.register(ProposalLogDocument, follow=[])
reversion.register(ProposalLogEntry, follow=['documents'])
reversion.register(MooringBay, follow=['proposal_set', 'mooring_set'])
reversion.register(Mooring, follow=['ria_generated_proposal', 'comms_logs', 'action_logs', 'mooringonapproval_set', 'approval_set'])
reversion.register(Mooring, follow=['ria_generated_proposal', 'comms_logs', 'action_logs', 'approval_set'])
reversion.register(MooringLogDocument, follow=[])
reversion.register(MooringLogEntry, follow=['documents'])
reversion.register(MooringUserAction, follow=[])
Expand Down

0 comments on commit 4dcefaa

Please sign in to comment.