diff --git a/participate.py b/participate.py index a75d2d7..ab7e0ab 100755 --- a/participate.py +++ b/participate.py @@ -546,22 +546,24 @@ def save_staff_slot(turn_id, slot_id, user_id): """ Save staff given slot """ slot = Tetawebapp_staffs.query.filter(Tetawebapp_staffs.turn_id==turn_id, Tetawebapp_staffs.slot_num==slot_id).count() if slot == 0: - slot = Tetawebapp_staffs(user_id=user_id, - turn_id=turn_id, - slot_num=slot_id) - try: - db.session.add(slot) - commit = db.session.commit() - except Exception as e: - db.session.rollback() - print "[+] Error at save_staff_slot:" - print "------------------------------" - print "%s" % e.message - print "------------------------------" - return False - if commit != None: - return False - return True + slot = Tetawebapp_staffs.query.filter(Tetawebapp_staffs.turn_id==turn_id, Tetawebapp_staffs.user_id==user_id).count() + if slot == 0: + slot = Tetawebapp_staffs(user_id=user_id, + turn_id=turn_id, + slot_num=slot_id) + try: + db.session.add(slot) + commit = db.session.commit() + except Exception as e: + db.session.rollback() + print "[+] Error at save_staff_slot:" + print "------------------------------" + print "%s" % e.message + print "------------------------------" + return False + if commit != None: + return False + return True return False ######################################################################## diff --git a/static/scripts/participate.js b/static/scripts/participate.js index b4c11d9..4610e3e 100644 --- a/static/scripts/participate.js +++ b/static/scripts/participate.js @@ -62,7 +62,7 @@ function save_turn() { function update_sheet(obj, 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);} return true; } diff --git a/static/scripts/tetawebapp.js b/static/scripts/tetawebapp.js index 0cff5da..88559bc 100644 --- a/static/scripts/tetawebapp.js +++ b/static/scripts/tetawebapp.js @@ -131,7 +131,7 @@ function get_html_from_ajax(obj, url) { xhttp.onload = function(){ if (xhttp.status != 200) { obj.innerHTML = "Error while getting content (2)"; - } + } }; xhttp.onreadystatechange = function() {