Skip to content

Commit

Permalink
Merge pull request #543 from awf-dbca/submission-fix
Browse files Browse the repository at this point in the history
Submission fix
  • Loading branch information
preranaandure authored Feb 20, 2025
2 parents 9b64b3e + a0b022d commit e96f719
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mooringlicensing/components/proposals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,9 @@ def proposed_approval(self, request, details):
if not i.mooring:
raise serializers.ValidationError("Mooring does not exist")

if not self.vessel_length or not self.vessel_draft or not self.vessel_weight:
raise serializers.ValidationError("One or more vessel dimensions are not specified")

if (self.vessel_length > i.mooring.vessel_size_limit or
self.vessel_draft > i.mooring.vessel_draft_limit or
(self.vessel_weight > i.mooring.vessel_weight_limit and i.mooring.vessel_weight_limit > 0)):
Expand Down Expand Up @@ -2331,6 +2334,8 @@ def has_higher_vessel_category(self):
return False

def vessel_mooring_compatible(self, mooring):
if not self.vessel_length or not self.vessel_draft or not self.vessel_weight:
return False
if (self.vessel_length > mooring.vessel_size_limit or
self.vessel_draft > mooring.vessel_draft_limit or
(mooring.vessel_weight_limit and self.vessel_weight > mooring.vessel_weight_limit)):
Expand Down Expand Up @@ -2714,7 +2719,7 @@ def validate_against_existing_proposals_and_approvals(self):
# Get blocking approvals
approvals = Approval.objects.filter(
(
Q(current_proposal__vessel_ownership__vessel=vessel) |
(Q(current_proposal__vessel_ownership__vessel=vessel) & ~Q(current_proposal__vessel_ownership__vessel=None)) |
Q(current_proposal__vessel_ownership__vessel__rego_no=self.rego_no)
) &
(
Expand Down

0 comments on commit e96f719

Please sign in to comment.