"BUGFIX: Un staffer ne peut pas selectionner plusieurs créneaux du même tour"

This commit is contained in:
Doug Le Tough 2018-03-10 00:13:54 +01:00
parent fe10a9320e
commit d7ed7007e4
3 changed files with 20 additions and 18 deletions

View File

@ -546,22 +546,24 @@ def save_staff_slot(turn_id, slot_id, user_id):
""" Save staff given slot """ """ Save staff given slot """
slot = Tetawebapp_staffs.query.filter(Tetawebapp_staffs.turn_id==turn_id, Tetawebapp_staffs.slot_num==slot_id).count() slot = Tetawebapp_staffs.query.filter(Tetawebapp_staffs.turn_id==turn_id, Tetawebapp_staffs.slot_num==slot_id).count()
if slot == 0: if slot == 0:
slot = Tetawebapp_staffs(user_id=user_id, slot = Tetawebapp_staffs.query.filter(Tetawebapp_staffs.turn_id==turn_id, Tetawebapp_staffs.user_id==user_id).count()
turn_id=turn_id, if slot == 0:
slot_num=slot_id) slot = Tetawebapp_staffs(user_id=user_id,
try: turn_id=turn_id,
db.session.add(slot) slot_num=slot_id)
commit = db.session.commit() try:
except Exception as e: db.session.add(slot)
db.session.rollback() commit = db.session.commit()
print "[+] Error at save_staff_slot:" except Exception as e:
print "------------------------------" db.session.rollback()
print "%s" % e.message print "[+] Error at save_staff_slot:"
print "------------------------------" print "------------------------------"
return False print "%s" % e.message
if commit != None: print "------------------------------"
return False return False
return True if commit != None:
return False
return True
return False return False
######################################################################## ########################################################################

View File

@ -62,7 +62,7 @@ function save_turn() {
function update_sheet(obj, turn, slot) { function update_sheet(obj, turn, slot) {
var url = '/staffsheet/update/'+turn+'/'+slot; var url = '/staffsheet/update/'+turn+'/'+slot;
get_html_from_ajax(obj, url); get_html_from_ajax(obj, url)
obj.onclick=function (){ return clear_sheet(obj, turn, slot);} obj.onclick=function (){ return clear_sheet(obj, turn, slot);}
return true; return true;
} }

View File

@ -131,7 +131,7 @@ function get_html_from_ajax(obj, url) {
xhttp.onload = function(){ xhttp.onload = function(){
if (xhttp.status != 200) { if (xhttp.status != 200) {
obj.innerHTML = "Error while getting content (2)"; obj.innerHTML = "Error while getting content (2)";
} }
}; };
xhttp.onreadystatechange = function() { xhttp.onreadystatechange = function() {