Browse Source

Removes error stuff

Jose Reyes 6 years ago
parent
commit
2560b41cae
1 changed files with 19 additions and 24 deletions
  1. 19
    24
      app/index.py

+ 19
- 24
app/index.py View File

13
         cName = request.form['cName']
13
         cName = request.form['cName']
14
         cEmail = request.form['cEmail']
14
         cEmail = request.form['cEmail']
15
         station_name = request.form['station']
15
         station_name = request.form['station']
16
-        error = None
17
 
16
 
18
-        if not cName:
19
-            error = 'Name is required.'
20
-        elif not cEmail:
21
-            error = 'Email is required'
22
-        else:
23
-            db = get_db()
24
-            station_id = db.execute(
25
-                'SELECT s_id FROM station WHERE nombre_empleado=?',
26
-                (station_name,)
27
-            ).fetchone()
28
-            db.execute(
29
-                'UPDATE station SET last_turn = last_turn + 1 WHERE s_id=?',
30
-                (station_id,)
31
-            )
32
-            turn = db.execute(
33
-                'SELECT last_turn FROM station WHERE s_id=?',
34
-                (station_id,)
35
-            ).fetchone()
36
-            db.execute(
37
-                'INSERT INTO turno (cName, cEmail, turn, timeArrival, station)'
38
-                ' VALUES (?, ?, ?, ?)',
39
-                (cName, cEmail, turn, 'testin', station_id)
40
-            )
17
+        db = get_db()
18
+        station_id = db.execute(
19
+            'SELECT s_id FROM station WHERE nombre_empleado=?',
20
+            (station_name,)
21
+        ).fetchone()
22
+        db.execute(
23
+            'UPDATE station SET last_turn = last_turn + 1 WHERE s_id=?',
24
+            (station_id,)
25
+        )
26
+        turn = db.execute(
27
+            'SELECT last_turn FROM station WHERE s_id=?',
28
+            (station_id,)
29
+        ).fetchone()
30
+        db.execute(
31
+            'INSERT INTO turno (cName, cEmail, turn, timeArrival, station)'
32
+            ' VALUES (?, ?, ?, ?)',
33
+            (cName, cEmail, turn, 'testin', station_id)
34
+        )
41
         db.commit()
35
         db.commit()
42
         return redirect(url_for('index.index'))
36
         return redirect(url_for('index.index'))
37
+
43
     return render_template('index.html')
38
     return render_template('index.html')