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

Merge branch 'it18218640' into 'master'

It18218640

See merge request !158
parents fafa2531 3415aefe
......@@ -110,18 +110,18 @@ def store():
date = req['date']
result = "Good"
time = "2S"
usersId = 1
userId = 1
try:
response = storeResult(value, date, result, time, usersId)
return response
response = storeResult(date, result, userId, time, value)
print(response)
body = jsonify(value)
return make_response(body)
except Exception as e:
print(e)
return e
# Read Function Route (IT)
# Loging
@app.route("/login", methods=['POST'])
def login():
......@@ -165,4 +165,4 @@ def reading():
if __name__ == "__main__":
app.run(host='192.168.1.100')
app.run(host='192.168.8.101')
......@@ -12,7 +12,7 @@ def create_con():
database="helply",
host="127.0.0.1",
user="root",
password="12345678"
password="rp19970520"
)
return db
......
......@@ -43,12 +43,12 @@ def get_color_activities2():
return jsonify(data_dic)
def storeResult(value, date, result, time, usersId):
def storeResult(date, result, userId, time, value):
try:
qry = 'INSERT INTO coloractivityresult VALUES (NULL, %s, %s, %s, %s, %s)'
qry = 'INSERT INTO coloractivityresult (idColorActivityResult, date, result, userId, time, value) VALUES (NULL, %s, %s, %s, %s, %s)'
args = (date, result, usersId, time, value)
args = (date, result, userId, time, value)
response = insert(qry, args)
return response
......
export const mainColor = [ "Red", "Green", "Black", "Yellow", "Blue", "White" ];
export const secondColor = [ "red", "green", "black", "yellow", "blue", "white" ];
\ No newline at end of file
......@@ -3,17 +3,19 @@ import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import {mainColor} from '../../assets/color/color';
import {secondColor} from '../../assets/color/color';
import CountDown from 'react-native-countdown-component';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
import Tts from 'react-native-tts';
import BackButton from "../../component/BackButton"
export default function Black() {
const navigation = useNavigation();
const backColor = "black";
React.useEffect(() => {
StatusBar.setHidden(true);
......@@ -59,13 +61,11 @@ export default function Black() {
const value = e.value;
if (value.includes(backColor) == true) {
var color = "Red";
if (value.includes(secondColor[2]) == true) {
console.log('Your Answer is Correct');
sendData(color)
sendData(mainColor[2])
showAlert = () => {
this.setState({
......@@ -73,6 +73,7 @@ export default function Black() {
});
};
} else {
console.log('Your Answer is Incorrect', value);
......@@ -165,7 +166,7 @@ export default function Black() {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[2], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
......@@ -3,10 +3,12 @@ import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import {mainColor} from '../../assets/color/color';
import {secondColor} from '../../assets/color/color';
import CountDown from 'react-native-countdown-component';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
import Tts from 'react-native-tts';
import BackButton from "../../component/BackButton"
......@@ -14,7 +16,6 @@ import BackButton from "../../component/BackButton"
export default function Blue2() {
const navigation = useNavigation();
const backColor = "blue";
React.useEffect(() => {
......@@ -61,10 +62,12 @@ export default function Blue2() {
const value = e.value;
if(value.includes(backColor) == true){
if(value.includes(secondColor[4]) == true){
console.log('Your Answer is Correct');
sendData(mainColor[4]);
showAlert = () => {
this.setState({
showAlert: true
......@@ -81,6 +84,34 @@ export default function Blue2() {
};
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);
......@@ -136,7 +167,7 @@ export default function Blue2() {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[4], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import {mainColor} from '../../assets/color/color';
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import CountDown from 'react-native-countdown-component';
import {secondColor} from '../../assets/color/color';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
......@@ -14,7 +16,6 @@ import BackButton from "../../component/BackButton"
export default function Green() {
const navigation = useNavigation();
const backColor = "green";
React.useEffect(() => {
......@@ -61,10 +62,14 @@ export default function Green() {
const value = e.value;
if(value.includes(backColor) == true){
if(value.includes(secondColor[1]) == true){
var color = "Green";
console.log('Your Answer is Correct');
sendData(mainColor[1])
showAlert = () => {
this.setState({
showAlert: true
......@@ -81,6 +86,34 @@ export default function Green() {
};
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);
......@@ -136,7 +169,7 @@ export default function Green() {
<Image style={styles.blackboard} source={require("../../assets/game/back2.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[1], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import {mainColor} from '../../assets/color/color';
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import {secondColor} from '../../assets/color/color';
import CountDown from 'react-native-countdown-component';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
......@@ -14,7 +16,6 @@ import BackButton from "../../component/BackButton"
export default function Red() {
const navigation = useNavigation();
const backColor = "red";
React.useEffect(() => {
......@@ -61,10 +62,12 @@ export default function Red() {
const value = e.value;
if(value.includes(backColor) == true){
if(value.includes(secondColor[0]) == true){
console.log('Your Answer is Correct');
sendData(mainColor[0])
showAlert = () => {
this.setState({
showAlert: true
......@@ -81,6 +84,34 @@ export default function Red() {
};
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);
......@@ -136,7 +167,7 @@ export default function Red() {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[0], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
import { useNavigation } from "@react-navigation/native";
import {mainColor} from '../../assets/color/color';
import Orientation from 'react-native-orientation-locker';
import React, { useEffect, useState } from "react";
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import {secondColor} from '../../assets/color/color';
import CountDown from 'react-native-countdown-component';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
......@@ -14,7 +16,6 @@ import BackButton from "../../component/BackButton"
export default function White() {
const navigation = useNavigation();
const backColor = "white";
React.useEffect(() => {
......@@ -61,10 +62,12 @@ export default function White() {
const value = e.value;
if(value.includes(backColor) == true){
if(value.includes(secondColor[5]) == true){
console.log('Your Answer is Correct');
sendData(mainColor[5])
showAlert = () => {
this.setState({
showAlert: true
......@@ -81,6 +84,34 @@ export default function White() {
};
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);
......@@ -136,7 +167,7 @@ export default function White() {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[5], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
import { useNavigation } from "@react-navigation/native";
import Orientation from 'react-native-orientation-locker';
import {secondColor} from '../../assets/color/color';
import React, { useEffect, useState } from "react";
import { Text, TouchableOpacity, StyleSheet, View, Dimensions, SafeAreaView, ImageBackground, Button, Image, StatusBar } from 'react-native';
import axios from "axios";
import CountDown from 'react-native-countdown-component';
import {mainColor} from '../../assets/color/color';
import client from "../client/Client";
import Voice from '@react-native-voice/voice';
......@@ -14,7 +16,6 @@ import BackButton from "../../component/BackButton"
export default function Yellow() {
const navigation = useNavigation();
const backColor = "yellow";
React.useEffect(() => {
......@@ -61,10 +62,12 @@ export default function Yellow() {
const value = e.value;
if(value.includes(backColor) == true){
if(value.includes(secondColor[3]) == true){
console.log('Your Answer is Correct');
sendData(mainColor[3])
showAlert = () => {
this.setState({
showAlert: true
......@@ -81,6 +84,34 @@ export default function Yellow() {
};
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);
......@@ -136,7 +167,7 @@ export default function Yellow() {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
<View style={{ width: 180, height: 180, backgroundColor: secondColor[3], marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
......
......@@ -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.101: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