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

add new route

parent dd1d750c
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
import random import random
import os import os
from API.model.colorModel import get_color_activities, get_color_activity_result from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result
from API.model.readModel import get_reading_activities from API.model.readModel import get_reading_activities
from API.routers.router import funtion_one from API.routers.router import funtion_one
from backend.IT18218640.keyword_spotting_service import Keyword_Spotting_service from backend.IT18218640.keyword_spotting_service import Keyword_Spotting_service
...@@ -16,9 +16,13 @@ def home(): ...@@ -16,9 +16,13 @@ def home():
# Color Function Route (IT18218640) # Color Function Route (IT18218640)
@app.route("/getColorActivities") @app.route("/getColorActivities1")
def getColorActivities(): def getColorActivities1():
return get_color_activities()\ return get_color_activities1()
@app.route("/getColorActivities2")
def getColorActivities2():
return get_color_activities2()
@app.route("/getColorActivitiesResult") @app.route("/getColorActivitiesResult")
def getColorActivitiesResult(): def getColorActivitiesResult():
......
...@@ -2,10 +2,30 @@ from flask import jsonify ...@@ -2,10 +2,30 @@ from flask import jsonify
from API.db.dbConnection import get_all_data from API.db.dbConnection import get_all_data
def get_color_activities(): def get_color_activities1():
data_dic = [] data_dic = []
qry = 'SELECT * FROM coloractivities' qry = 'SELECT * FROM coloractivities WHERE idactivityType = 1'
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_activities2():
data_dic = []
qry = 'SELECT * FROM coloractivities WHERE idactivityType = 2'
result = get_all_data(qry) result = get_all_data(qry)
......
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