Commit c460d9e0 authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

API - Removed Unwanted Function

parent 065e790b
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<list> <list>
<option value="N802" /> <option value="N802" />
<option value="N806" /> <option value="N806" />
<option value="N803" />
</list> </list>
</option> </option>
</inspection_tool> </inspection_tool>
......
# import MySQLdb # import MySQLdb
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
<<<<<<< HEAD
from API.model.colorModel import get_color_activities1, get_color_activities2, 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, save_activity_details from API.model.readModel import get_reading_activities, save_activity_details
from API.model.userModel import getUser, saveUserSession from API.model.userModel import getUser, saveUserSession
=======
from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result, storeResult from API.model.colorModel import get_color_activities1, get_color_activities2, get_color_activity_result, storeResult
from API.model.readModel import get_reading_activities from API.model.readModel import get_reading_activities
from API.model.userModel import getStudentByName
>>>>>>> 4377b9c5fafb5c155a043560f662f4da96c37e12
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
...@@ -51,14 +46,11 @@ def getColorActivitiesResult(): ...@@ -51,14 +46,11 @@ def getColorActivitiesResult():
@app.route("/predict", methods=["POST"]) @app.route("/predict", methods=["POST"])
def predict(): def predict():
<<<<<<< HEAD
data = request.get_json() data = request.get_json()
print((f"{data}")) print((f"{data}"))
=======
try: try:
data = request.get_json() data = request.get_json()
>>>>>>> 4377b9c5fafb5c155a043560f662f4da96c37e12
fileitem = data['uri'] fileitem = data['uri']
...@@ -131,10 +123,6 @@ def store(): ...@@ -131,10 +123,6 @@ def store():
print(e) print(e)
return e return e
# Read Function Route (IT) # Read Function Route (IT)
...@@ -197,10 +185,4 @@ def reading(): ...@@ -197,10 +185,4 @@ def reading():
if __name__ == "__main__": if __name__ == "__main__":
<<<<<<< HEAD app.run(host='192.168.1.100')
app.run(host='192.168.1.101')
=======
app.run(host='192.168.8.101')
# app.run(host='192.168.8.102')
# app.run(debug=True)
>>>>>>> 4377b9c5fafb5c155a043560f662f4da96c37e12
...@@ -12,7 +12,7 @@ def create_con(): ...@@ -12,7 +12,7 @@ def create_con():
database="helply", database="helply",
host="127.0.0.1", host="127.0.0.1",
user="root", user="root",
password="rp19970520" password="12345678"
) )
return db return db
...@@ -24,7 +24,6 @@ def create_con_pandas(): ...@@ -24,7 +24,6 @@ def create_con_pandas():
def get_all_data(query): def get_all_data(query):
db = create_con() db = create_con()
cursor = db.cursor() cursor = db.cursor()
cursor.execute(query) cursor.execute(query)
...@@ -33,26 +32,6 @@ def get_all_data(query): ...@@ -33,26 +32,6 @@ def get_all_data(query):
return result return result
def get_reading_data(query):
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 result
def insert_data_pandas_df(pd_df, table_name): def insert_data_pandas_df(pd_df, table_name):
db = create_con_pandas() db = create_con_pandas()
...@@ -125,22 +104,6 @@ def insert_data_get_id(sql_query): ...@@ -125,22 +104,6 @@ def insert_data_get_id(sql_query):
return e return e
def insert_data_main_response(trip_info_sql, trip_df):
db = create_con()
cursor = db.cursor()
try:
cursor.execute(trip_info_sql)
insert_data_pandas_df(trip_df, 'trip')
db.commit()
db.close()
return 1
except Exception as e:
db.rollback()
db.close()
return e
def get_data(sql_query): def get_data(sql_query):
db = create_con() db = create_con()
cursor = db.cursor() cursor = db.cursor()
...@@ -174,6 +137,7 @@ def update_data(sql_query): ...@@ -174,6 +137,7 @@ def update_data(sql_query):
print(e) print(e)
return e return e
def insert(sql_query, args): def insert(sql_query, args):
db = create_con() db = create_con()
cursor = db.cursor() cursor = db.cursor()
......
from API.db.dbConnection import get_reading_data, insert from API.db.dbConnection import get_all_data, insert
from flask import jsonify from flask import jsonify
...@@ -6,7 +6,7 @@ def get_reading_activities(): ...@@ -6,7 +6,7 @@ def get_reading_activities():
data_dic = [] data_dic = []
qry = 'SELECT * FROM reading' qry = 'SELECT * FROM reading'
result = get_reading_data(qry) result = get_all_data(qry)
for row in result: for row in result:
ob = { ob = {
......
...@@ -3,6 +3,7 @@ from API.db.dbConnection import insert ...@@ -3,6 +3,7 @@ from API.db.dbConnection import insert
from API.util.util import getUUID from API.util.util import getUUID
from datetime import datetime from datetime import datetime
def getUser(email, password): def getUser(email, password):
qry = 'SELECT * FROM `user` WHERE email = "{}" AND password = "{}"'.format(email, password) qry = 'SELECT * FROM `user` WHERE email = "{}" AND password = "{}"'.format(email, password)
...@@ -15,5 +16,5 @@ def saveUserSession(userId): ...@@ -15,5 +16,5 @@ def saveUserSession(userId):
token = getUUID() token = getUUID()
qry = 'INSERT INTO userSession (id,userId,token,loginTime,status) VALUES (NULL, %s, %s, %s, %s)' qry = 'INSERT INTO userSession (id,userId,token,loginTime,status) VALUES (NULL, %s, %s, %s, %s)'
args = (userId, token, loginTime, 1) args = (userId, token, loginTime, 1)
result = insert(qry, args) insert(qry, args)
return token return token
...@@ -2,10 +2,6 @@ import axios from 'axios'; ...@@ -2,10 +2,6 @@ import axios from 'axios';
// export default axios.create({ baseURL: 'http://192.168.8.102:5000/', timeout: 15000, }); // export default axios.create({ baseURL: 'http://192.168.8.102:5000/', timeout: 15000, });
export default axios.create({ export default axios.create({
<<<<<<< HEAD
baseURL: 'http://192.168.1.101:5000/', baseURL: 'http://192.168.1.101:5000/',
=======
baseURL: 'http://192.168.8.101:5000/',
>>>>>>> 4377b9c5fafb5c155a043560f662f4da96c37e12
timeout: 15000, timeout: 15000,
}); });
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