|
@@ -15,21 +15,25 @@ def index():
|
15
|
15
|
station_name = request.form['station']
|
16
|
16
|
|
17
|
17
|
db = get_db()
|
18
|
|
- station_id = db.execute(
|
|
18
|
+ station_query_res = db.execute(
|
19
|
19
|
'SELECT s_id FROM station WHERE nombre_empleado=?',
|
20
|
20
|
(station_name,)
|
21
|
21
|
).fetchone()
|
|
22
|
+ if station_query_res is not None:
|
|
23
|
+ station_id = station_query_res[0]
|
22
|
24
|
db.execute(
|
23
|
25
|
'UPDATE station SET last_turn = last_turn + 1 WHERE s_id=?',
|
24
|
26
|
(station_id,)
|
25
|
27
|
)
|
26
|
|
- turn = db.execute(
|
|
28
|
+ turn_query_res = db.execute(
|
27
|
29
|
'SELECT last_turn FROM station WHERE s_id=?',
|
28
|
30
|
(station_id,)
|
29
|
31
|
).fetchone()
|
|
32
|
+ if turn_query_res is not None:
|
|
33
|
+ turn = turn_query_res[0]
|
30
|
34
|
db.execute(
|
31
|
35
|
'INSERT INTO turno (cName, cEmail, turn, timeArrival, station)'
|
32
|
|
- ' VALUES (?, ?, ?, ?)',
|
|
36
|
+ ' VALUES (?, ?, ?, ?, ?)',
|
33
|
37
|
(cName, cEmail, turn, 'testin', station_id)
|
34
|
38
|
)
|
35
|
39
|
db.commit()
|