def insert_survey(): with UseDatabase(app.config['dbconfig']) as cursor: if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'gender'] age = rows['age'] pain_duration = rows['pain_duration'] q1 = rows['q1'] q2 = rows['q2'] q3 = rows['q3'] q4 = rows['q4'] q5 = rows['q5'] meds = rows['meds'] q6 = rows['q6'] q7 = rows['q7'] q8 = rows['q8'] q9 = rows['q9'] q10 = rows['q10'] q11 = rows['q11'] q12 = rows['q12'] q13 = rows['q13'] _SQL = """insert into survey (user, gender, age, pain_duration, q1, q2, q3, q4, q5, meds, q6, q7, q8, q9, q10, q11, q12, q13) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s)""" cursor.execute( _SQL, (userid, gender, age, pain_duration, q1, q2, q3, q4, q5, meds, q6, q7, q8, q9, q10, q11, q12, q13)) return "Data Inserted"
def insert(): with UseDatabase(app.config['dbconfig']) as cursor: if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'key_pressed'] outcome = rows['outcome'] reaction_time = rows['reaction_time'] _SQL = """insert into wcst (user, key_pressed, outcome, reaction_time) values (%s, %s, %s, %s)""" cursor.execute(_SQL, (userid, key_pressed, outcome, reaction_time)) return "Data Inserted"
def insert_igt(): with UseDatabase(app.config['dbconfig']) as cursor: print("in inset iGT") if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'selected'] gain = rows['profit'] loss = rows['loss'] net_profit = rows['netamt'] total_amt = rows['finalcash'] _SQL = """insert into igt (user, choice, gain, loss, net_profit, total_amt) values (%s, %s, %s, %s, %s, %s)""" cursor.execute( _SQL, (userid, choice, gain, loss, net_profit, total_amt)) return "Data Inserted"
def insert_stroop(): with UseDatabase(app.config['dbconfig']) as cursor: if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'word'] color = rows['color'] time = rows['time'] keypressed = rows['keyPressed'] correct = rows['correct'] compatible = rows['compatible'] _SQL = """insert into stroop (user, word, color, time, keypressed, correct, compatible) values (%s, %s, %s, %s, %s, %s, %s)""" cursor.execute(_SQL, (userid, word, color, time, keypressed, correct, compatible)) return "Data Inserted"
def insert_prl(): with UseDatabase(app.config['dbconfig']) as cursor: if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'choice'] outcome = rows['outcome'] reactionTime = rows['reactionTime'] loc = rows['loc'] choiceLoc = rows['choiceLoc'] _SQL = """insert into prl (user, choice, outcome, reactionTime, loc, choiceLoc) values (%s, %s, %s, %s, %s, %s)""" cursor.execute( _SQL, (userid, choice, outcome, reactionTime, loc, choiceLoc)) return "Data Inserted"
def insert_icf(): with UseDatabase(app.config['dbconfig']) as cursor: if request.method == "POST": req_data = request.get_json() userid = str(session['uid']) print('user : '******'q1'] q2 = rows['q2'] q3 = rows['q3'] q4 = rows['q4'] q5 = rows['q5'] q6 = rows['q6'] q7 = rows['q7'] q8 = rows['q8'] q9 = rows['q9'] q10 = rows['q10'] _SQL = """insert into icf (user, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" cursor.execute( _SQL, (userid, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10)) return "Data Inserted"
def view_igt() -> 'html': with UseDatabase(app.config['dbconfig']) as cursor: _SQL = """select * from igt""" cursor.execute(_SQL) contents = cursor.fetchall() return render_template('view.html', the_data=contents)