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():
# Get Color result route
@app.route("/getColorActivitiesResult")
def getColorActivitiesResult():
req = request.get_json()
userId = req['userId']
# print("data_dic")
@app.route("/getColorActivitiesResult/<userId>", methods=['GET'])
def getColorActivitiesResult(userId):
# 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
......@@ -224,4 +229,4 @@ def reading_result(userId):
if __name__ == "__main__":
app.run(host='192.168.1.101')
app.run(host='192.168.8.100')
......@@ -12,7 +12,7 @@ def create_con():
database="helply",
host="127.0.0.1",
user="root",
password="12345678"
password="rp19970520"
)
return db
......
......@@ -129,3 +129,7 @@ def sendPredictData(audioFile, name):
print(f"data: {data}")
return jsonify(data)
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';
const userId = 1;
// const [tableContent, setTableContent] = useState();
const CONTENT = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [],
};
const CONTENT2 = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [
['1 jan 2022', '2s', 'Red', 'Good'],
......@@ -16,7 +23,6 @@ const CONTENT = {
['5 jan 2022', '2s', 'Blue', 'Good'],
['6 jan 2022', '2s', 'Yellow', 'Good'],
],
};
......@@ -24,22 +30,15 @@ export default function App() {
function getResult(userId) {
var data = {
userId: userId,
user: "userId",
}
data = JSON.stringify(data);
console.log(data);
client.post('getColorActivitiesResult', data, {
client.get('getColorActivitiesResult/'+userId, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
}).then((response) => {
console.log(response.data);
CONTENT.tableData = response.data.data
console.log(CONTENT.tableData);
console.log(CONTENT2.tableData);
}).catch(err => {
console.log(err);
});
......@@ -59,14 +58,14 @@ export default function App() {
data={CONTENT.tableHead}
flexArr={[1, 1, 1, 1]}
style={styles.head}
// textStyle={styles.text}
textStyle={styles.text}
/>
<TableWrapper style={styles.wrapper}>
<Rows
data={CONTENT.tableData}
data={CONTENT2.tableData}
flexArr={[1, 1, 1, 1]}
style={styles.row}
// textStyle={styles.text}
textStyle={styles.text}
/>
</TableWrapper>
</Table>
......@@ -82,5 +81,5 @@ const styles = StyleSheet.create({
wrapper: { flexDirection: 'row' },
title: { flex: 1, },
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';
// export default axios.create({ baseURL: 'http://192.168.8.102:5000/', timeout: 15000, });
export default axios.create({
baseURL: 'http://192.168.1.101:5000/',
baseURL: 'http://192.168.8.100:5000/',
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