Commit 70243eb7 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

Merge branch 'it18218640' into 'master'

create getColorActivitiesResult function

See merge request !120
parents 9bbc61d3 5800bb45
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
from API.model.colorModel import get_color_activities
from API.model.colorModel import get_color_activities, get_color_activity_result
from API.model.readModel import get_reading_activities
from API.routers.router import funtion_one
......@@ -16,7 +16,12 @@ def home():
# Color Function Route (IT18218640)
@app.route("/getColorActivities")
def getColorActivities():
return get_color_activities()
return get_color_activities()\
@app.route("/getColorActivitiesResult")
def getColorActivitiesResult():
# print("data_dic")
return get_color_activity_result()
# Read Function Route (IT)
......@@ -45,11 +50,7 @@ def abc():
if __name__ == "__main__":
<<<<<<< HEAD
app.run(host='192.168.8.102')
=======
app.run(host='192.168.8.101')
app.run(host='192.168.8.100')
# app.run(host='192.168.8.100,port='5000', debug=True)
# app.run(debug=True)
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
......@@ -24,24 +24,13 @@ def create_con_pandas():
def get_all_data(query):
data_dic = []
db = create_con()
cursor = db.cursor()
cursor.execute(query)
result = cursor.fetchall()
for row in result:
ob = {
"idcolorActivities": row[0],
"name": row[1],
"file": row[2],
"des": row[3],
"color": row[4],
}
data_dic.append(ob)
return jsonify(data_dic)
return result
def get_reading_data(query):
......
from flask import jsonify
from API.db.dbConnection import get_all_data
def get_color_activities():
data_dic = []
qry = 'SELECT * FROM coloractivities'
response = get_all_data(qry)
result = get_all_data(qry)
for row in result:
ob = {
"idcolorActivities": row[0],
"name": row[1],
"file": row[2],
"des": row[3],
"color": row[4],
}
data_dic.append(ob)
return jsonify(data_dic)
def get_color_activity_result():
data_dic = []
qry = 'SELECT * FROM coloractivityresult'
result = get_all_data(qry)
for row in result:
ob = {
"idcoloractivityresult": row[0],
"idcolorActivities": row[1],
"date": row[2],
"time": row[3],
"result": row[4],
}
data_dic.append(ob)
return response
return jsonify(data_dic)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment