Skip to content

Commit

Permalink
hotfix: require nese shares to be divisible by 20
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Oct 30, 2023
1 parent 567bd89 commit 2d3569d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,6 @@ def post(self, request, *args, **kwargs):
if new_value != attribute_change.new_value:
attribute_change.new_value = new_value
attribute_change.save()

if action == 'update':
message = 'Allocation change request updated!'
if action == 'approve':
Expand Down Expand Up @@ -2055,6 +2054,13 @@ def post(self, request, *args, **kwargs):
formset_data = entry.cleaned_data

new_value = formset_data.get('new_value')
# require nese shares to be divisible by 20
tbs = int(new_value) if formset_data['name'] == 'Storage Quota (TB)' else False
nese = bool(allocation_obj.resources.filter(name__contains="nesetape"))
if nese and tbs and tbs % 20 != 0:
messages.error(request, "Tier 3 quantity must be a multiple of 20.")
return HttpResponseRedirect(reverse('allocation-change', kwargs={'pk': pk}))

if new_value != '':
change_requested = True
allocation_attribute = AllocationAttribute.objects.get(
Expand Down

0 comments on commit 2d3569d

Please sign in to comment.