Skip to content

Commit ddbe092

Browse files
authored
Merge pull request #1 from jjsearle/master
Bug Fix : Invalid json added to payload when not specifying in_MAC or out_MAC
2 parents a50b474 + 1c47c99 commit ddbe092

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

move_by_attribute/process_move.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
LOGOUT_MAC = args.out_MAC
2626

2727
to_seat_id = 0
28-
if (len(table_macs_to_seats.search(Query().mac == LOGIN_MAC)) > 0):
29-
to_seat_id = table_macs_to_seats.search(Query().mac == LOGIN_MAC)[0]['seat']
28+
if LOGIN_MAC:
29+
if (len(table_macs_to_seats.search(Query().mac == LOGIN_MAC)) > 0):
30+
to_seat_id = table_macs_to_seats.search(Query().mac == LOGIN_MAC)[0]['seat']
3031

3132
from_seat_id = 0
32-
if (len(table_macs_to_seats.search(Query().mac == LOGOUT_MAC)) > 0):
33-
from_seat_id = table_macs_to_seats.search(Query().mac == LOGOUT_MAC)[0]['seat']
33+
if LOGOUT_MAC:
34+
if (len(table_macs_to_seats.search(Query().mac == LOGOUT_MAC)) > 0):
35+
from_seat_id = table_macs_to_seats.search(Query().mac == LOGOUT_MAC)[0]['seat']
3436

3537
move_body = {'employee_id': EMPLOYEE_EMAIL.split('@', 1)[0],
3638
'move_time': str(datetime.datetime.now().replace(microsecond=0)),
@@ -55,4 +57,4 @@
5557

5658
response = requests.put(conf.URL_BASE + conf.URL_MOVES + '/' + str(move_id) + '/complete', headers=conf.HEADERS)
5759

58-
print(str(response.status_code) + ': ' + response.reason)
60+
print(str(response.status_code) + ': ' + response.reason)

0 commit comments

Comments
 (0)