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

Merge branch 'it18218640' into 'master'

change route

See merge request !151
parents 2464f719 a9c4163c
......@@ -5,7 +5,7 @@ import mysql
from flask import Flask, redirect, url_for, render_template, request, jsonify, make_response
import random
import os
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, storeResult
from API.model.readModel import get_reading_activities
from API.model.userModel import getStudentByName
from API.routers.router import funtion_one
......@@ -125,6 +125,17 @@ def predict():
# return jsonify("print")
# return "Print"
@app.route("/store", methods=["POST"])
def store():
req = request.get_json()
value = req['value']
date = req['date']
result = "Good"
time = "2S"
usersId = 1
response = storeResult(value, date, result, time, usersId)
# Read Function Route (IT)
......
from flask import jsonify
from API.db.dbConnection import get_all_data
from API.db.dbConnection import get_all_data, insert_data_json, insert_data
def get_color_activities1():
data_dic = []
......@@ -42,6 +43,14 @@ def get_color_activities2():
return jsonify(data_dic)
def storeResult(value, date, result, time, usersId):
qry = 'INSERT INTO coloractivityresult VALUES (NULL, % s, % s, % s, % s, % s)', (date, result, time, usersId, value)
response = insert_data(qry)
return response
def get_color_activity_result():
data_dic = []
......@@ -51,7 +60,7 @@ def get_color_activity_result():
for row in result:
ob = {
"idcoloractivityresult": row[0],
"idColorActivityResult": row[0],
"idcolorActivities": row[1],
"date": row[2],
"time": row[3],
......
......@@ -7,8 +7,6 @@ import CountDown from 'react-native-countdown-component';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
import BackButton from "../../component/BackButton"
export default function Black() {
......@@ -61,26 +59,57 @@ export default function Black() {
const value = e.value;
if(value.includes(backColor) == true){
if (value.includes(backColor) == true) {
var color = "Red";
console.log('Your Answer is Correct');
sendData(color)
showAlert = () => {
this.setState({
showAlert: true
showAlert: true
});
};
}else{
};
} else {
console.log('Your Answer is Incorrect', value);
}
};
function sendData(value) {
var date = new Date().getDate();
var month = new Date().getMonth() + 1;
var year = new Date().getFullYear();
var todayData = date + '-' + month + '-' + year;
var data = {
value: value,
date: todayData
}
data = JSON.stringify(data);
client.post('store', data, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
}).then((response) => {
console.log(response.data);
}).catch(err => {
console.log(err);
})
}
const onSpeechPartialResults = e => {
// console.log('onSpeechPartialResults: ', e);
......@@ -88,15 +117,15 @@ export default function Black() {
// console.log(value.length)
// setPartialResults(e.value);
};
};
const onFinishCD = () => {
const onFinishCD = () => {
Alert.alert('Countdown Finished...');
}
const onPressCD = () => {
}
const onPressCD = () => {
Alert.alert('Countdown Component Pressed...');
}
}
const startRecording = async () => {
......@@ -154,10 +183,10 @@ export default function Black() {
</TouchableOpacity>
</View>
<View style={{ marginLeft: -100, marginTop:-15 }}>
<View style={{ marginLeft: -100, marginTop: -15 }}>
<TouchableOpacity onPress={() => { }}
style={{ width: "60%", height: "50%", borderRadius: 50 }}>
<Image source={require('../../assets/game/finish.png')} resizeMode='contain' style={{ flex: .9, marginLeft: -150 }} />
<Image source={require('../../assets/game/finish.png')} resizeMode='contain' style={{ flex: .9, marginLeft: -120 }} />
</TouchableOpacity>
</View>
......
......@@ -157,7 +157,7 @@ export default function White() {
<View style={{ marginLeft: -100, marginTop:-15 }}>
<TouchableOpacity onPress={() => { }}
style={{ width: "60%", height: "50%", borderRadius: 50 }}>
<Image source={require('../../assets/game/finish.png')} resizeMode='contain' style={{ flex: .9, marginLeft: -150, }} />
<Image source={require('../../assets/game/finish.png')} resizeMode='contain' style={{ flex: .9, marginLeft: -120, }} />
</TouchableOpacity>
</View>
......
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