fix bugs wow
parent
a7d86d9077
commit
2bf01797b0
|
|
@ -92,7 +92,7 @@ def get_headset_details(hw_id):
|
|||
if len(values) == 1:
|
||||
return jsonify(values[0])
|
||||
else:
|
||||
return jsonify({'error', "Can't find headset with that id."}), 400
|
||||
return jsonify({'error': "Can't find headset with that id."}), 400
|
||||
|
||||
|
||||
def get_headset_details_db(hw_id):
|
||||
|
|
@ -113,15 +113,12 @@ def set_headset_details(hw_id):
|
|||
|
||||
|
||||
def set_headset_details_db(hw_id, data):
|
||||
logger.error(data)
|
||||
conn, curr = connectToDB()
|
||||
query = """
|
||||
INSERT INTO `Headset`(
|
||||
`hw_id`,
|
||||
`current_room`
|
||||
) VALUES(
|
||||
%(hw_id)s,
|
||||
%(current_room)s
|
||||
);
|
||||
UPDATE `Headset`
|
||||
SET `current_room` = %(current_room)s
|
||||
WHERE `hw_id` = %(hw_id)s;
|
||||
"""
|
||||
data['hw_id'] = hw_id
|
||||
curr.execute(query, data)
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ function httpPostAsync(theUrl, data, callback, failCallback) {
|
|||
}
|
||||
}
|
||||
xmlHttp.open("POST", theUrl, true); // true for asynchronous
|
||||
http.setRequestHeader('Content-type', 'application/json');
|
||||
xmlHttp.send(data);
|
||||
xmlHttp.setRequestHeader('Content-type', 'application/json');
|
||||
xmlHttp.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
|
|
@ -66,6 +66,17 @@ function writeId(idName, data) {
|
|||
document.getElementById(idName).innerHTML = data;
|
||||
}
|
||||
|
||||
function writeValue(className, data) {
|
||||
if (data == undefined || data == null || data.toString() == 'undefined') {
|
||||
data = "";
|
||||
}
|
||||
|
||||
let elements = document.getElementsByClassName(className);
|
||||
Array.from(elements).forEach(e => {
|
||||
e.value = data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function writeSrc(className, data) {
|
||||
if (data == undefined || data == null || data.toString() == 'undefined') {
|
||||
|
|
@ -76,4 +87,4 @@ function writeSrc(className, data) {
|
|||
Array.from(elements).forEach(e => {
|
||||
e.src = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@
|
|||
<div class="tile tile-centered">
|
||||
<div class="tile-content">
|
||||
<div class="tile-title text-bold">Current Room</div>
|
||||
<input class="btn" type="text" id="current_room" placeholder="----">
|
||||
<input class="btn current_room" type="text" id="current_room" placeholder="----">
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
<button class="btn btn-link btn-action btn-lg tooltip tooltip-left" id="set_room_id"
|
||||
data-tooltip="Set Room ID"><i class="icon icon-check"></i></button>
|
||||
<button class="btn btn-primary btn-lg tooltip tooltip-left" id="set_room_id"
|
||||
data-tooltip="Set Room ID">Set</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile tile-centered">
|
||||
|
|
@ -98,8 +98,8 @@
|
|||
console.log(resp);
|
||||
let respData = JSON.parse(resp);
|
||||
|
||||
writeClass('hw_id', respData['hw_data']);
|
||||
writeClass('current_room', respData['current_room']);
|
||||
writeClass('hw_id', respData['hw_id']);
|
||||
writeValue('current_room', respData['current_room']);
|
||||
writeClass('date_created', respData['date_created']);
|
||||
writeClass('last_used', respData['last_used']);
|
||||
|
||||
|
|
@ -133,4 +133,4 @@
|
|||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue