Skip to content

Commit

Permalink
Add check for deleted session when scheduling. Fixes #2450. Commit re…
Browse files Browse the repository at this point in the history
…ady for merge

 - Legacy-Id: 14842
  • Loading branch information
rpcross committed Mar 17, 2018
1 parent 49f00b7 commit 7211cf3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ietf/meeting/ajax.py
Expand Up @@ -455,6 +455,13 @@ def assignments_post(request, meeting, schedule):
status = 406,
content_type="application/json")

try:
Session.objects.get(pk=newvalues["session_id"])
except Session.DoesNotExist:
return HttpResponse(json.dumps({'error':'session has been deleted'}),
status = 406,
content_type="application/json")

ss1 = SchedTimeSessAssignment(schedule = schedule,
session_id = newvalues["session_id"],
timeslot_id = newvalues["timeslot_id"])
Expand Down
5 changes: 5 additions & 0 deletions ietf/static/ietf/js/agenda/agenda_objects.js
Expand Up @@ -482,6 +482,11 @@ ScheduledSlot.prototype.saveit = function() {
session.placed(myss.timeslot);
}
});
saveit.fail(function(jqXHR, textStatus) {
var xhr = JSON.parse(jqXHR.responseText);
alert("ERROR: " + xhr.error + "\nThe schedule will now reload.");
location.reload(true);
});

// return the promise, in case someone (tests!) needs to know when we are done.
return saveit;
Expand Down

0 comments on commit 7211cf3

Please sign in to comment.