is APPROVED or SENT and LINK or PARTNER, we can confidently set sent_by
@@ -748,15 +748,14 @@ class EvaluateApplicationView(NotDeleted, CoordinatorOrSelf, ToURequired, Update
def form_valid(self, form):
app = self.object
- status = form.cleaned_data['status']
# Correctly assign sent_by.
- if app.status == Application.SENT:
+ if app.status == Application.SENT or (app.is_instantly_finalized() and app.status == Application.APPROVED):
app.sent_by = self.request.user
app.save()
# The logic below hard limits coordinators from approving applications when a particular proxy partner has run out of accounts.
- if is_proxy_and_application_approved(status, app):
+ if is_proxy_and_application_approved(app.status, app):
if app.partner.status == Partner.WAITLIST:
# Translators: After a coordinator has changed the status of an application to APPROVED, if the corresponding partner/collection is waitlisted this message appears.
messages.add_message(self.request, messages.ERROR,
@@ -956,19 +955,11 @@ class BatchEditView(CoordinatorsOnly, ToURequired, View):
if app.specific_stream is not None and streams_distribution_flag[app.specific_stream.pk] is True:
batch_update_success.append(app_pk)
app.status = status
- app.save()
- # After the app is saved, we set sent_by if we sent the app.
- # Necessary because of instantly finalized apps.
- if app.status == Application.SENT and not app.sent_by:
app.sent_by = request.user
app.save()
elif partners_distribution_flag[app.partner.pk] is True:
batch_update_success.append(app_pk)
app.status = status
- app.save()
- # After the app is saved, we set sent_by if we sent the app.
- # Necessary because of instantly finalized apps.
- if app.status == Application.SENT and not app.sent_by:
app.sent_by = request.user
app.save()
else:
@@ -978,10 +969,7 @@ class BatchEditView(CoordinatorsOnly, ToURequired, View):
else:
batch_update_success.append(app_pk)
app.status = status
- app.save()
- # After the app is saved, we set sent_by if we sent the app.
- # Necessary because of instantly finalized apps.
- if app.status == Application.SENT and not app.sent_by:
+ if app.is_instantly_finalized() and app.status in [Application.APPROVED, Application.SENT]:
app.sent_by = request.user
app.save()
