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

changes

parent 5787e6e3
...@@ -39,15 +39,20 @@ def getColorActivities2(): ...@@ -39,15 +39,20 @@ def getColorActivities2():
# Get Color result route # Get Color result route
@app.route("/getColorActivitiesResult") @app.route("/getColorActivitiesResult/<userId>", methods=['GET'])
def getColorActivitiesResult(): def getColorActivitiesResult(userId):
req = request.get_json()
userId = req['userId']
# print("data_dic")
# result = get_color_activity_result(userId) assert userId == request.view_args['userId']
result = get_color_result(userId)
return userId response = {
"data": result,
"message": "Success",
"status": 200
}
body = jsonify(response)
return make_response(body)
# return userId
# Predict route # Predict route
...@@ -224,4 +229,4 @@ def reading_result(userId): ...@@ -224,4 +229,4 @@ def reading_result(userId):
if __name__ == "__main__": if __name__ == "__main__":
app.run(host='192.168.1.101') app.run(host='192.168.8.100')
...@@ -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="12345678" password="rp19970520"
) )
return db return db
......
...@@ -128,4 +128,8 @@ def sendPredictData(audioFile, name): ...@@ -128,4 +128,8 @@ def sendPredictData(audioFile, name):
data = {"Predicted Keyword": FPFN} data = {"Predicted Keyword": FPFN}
print(f"data: {data}") print(f"data: {data}")
return jsonify(data) return jsonify(data)
\ No newline at end of file
def get_color_result(userId):
qry = 'SELECT date, time, value, result FROM coloractivityresult WHERE userId = "{}"'.format(userId)
return get_data(qry)
\ No newline at end of file
...@@ -6,7 +6,14 @@ import client from '../screen/client/Client'; ...@@ -6,7 +6,14 @@ import client from '../screen/client/Client';
const userId = 1; const userId = 1;
// const [tableContent, setTableContent] = useState();
const CONTENT = { const CONTENT = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [],
};
const CONTENT2 = {
tableHead: ['Date', 'Time', 'Name', 'Result'], tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [ tableData: [
['1 jan 2022', '2s', 'Red', 'Good'], ['1 jan 2022', '2s', 'Red', 'Good'],
...@@ -16,7 +23,6 @@ const CONTENT = { ...@@ -16,7 +23,6 @@ const CONTENT = {
['5 jan 2022', '2s', 'Blue', 'Good'], ['5 jan 2022', '2s', 'Blue', 'Good'],
['6 jan 2022', '2s', 'Yellow', 'Good'], ['6 jan 2022', '2s', 'Yellow', 'Good'],
], ],
}; };
...@@ -24,22 +30,15 @@ export default function App() { ...@@ -24,22 +30,15 @@ export default function App() {
function getResult(userId) { function getResult(userId) {
var data = { client.get('getColorActivitiesResult/'+userId, {
userId: userId,
user: "userId",
}
data = JSON.stringify(data);
console.log(data);
client.post('getColorActivitiesResult', data, {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}).then((response) => { }).then((response) => {
console.log(response.data); CONTENT.tableData = response.data.data
console.log(CONTENT.tableData);
console.log(CONTENT2.tableData);
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
...@@ -59,14 +58,14 @@ export default function App() { ...@@ -59,14 +58,14 @@ export default function App() {
data={CONTENT.tableHead} data={CONTENT.tableHead}
flexArr={[1, 1, 1, 1]} flexArr={[1, 1, 1, 1]}
style={styles.head} style={styles.head}
// textStyle={styles.text} textStyle={styles.text}
/> />
<TableWrapper style={styles.wrapper}> <TableWrapper style={styles.wrapper}>
<Rows <Rows
data={CONTENT.tableData} data={CONTENT2.tableData}
flexArr={[1, 1, 1, 1]} flexArr={[1, 1, 1, 1]}
style={styles.row} style={styles.row}
// textStyle={styles.text} textStyle={styles.text}
/> />
</TableWrapper> </TableWrapper>
</Table> </Table>
...@@ -82,5 +81,5 @@ const styles = StyleSheet.create({ ...@@ -82,5 +81,5 @@ const styles = StyleSheet.create({
wrapper: { flexDirection: 'row' }, wrapper: { flexDirection: 'row' },
title: { flex: 1, }, title: { flex: 1, },
row: { height: 40 }, row: { height: 40 },
// text: { textAlign: 'center', fontSize: 20, color: '#fff', }, text: { textAlign: 'center', fontSize: 20, color: '#fff', },
}); });
\ No newline at end of file
...@@ -2,6 +2,6 @@ import axios from 'axios'; ...@@ -2,6 +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({
baseURL: 'http://192.168.1.101:5000/', baseURL: 'http://192.168.8.100:5000/',
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