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

Submission fix #543

Merged
merged 3 commits into from
Feb 20, 2025
Merged
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
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
Loading