Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J 38
21_22-J 38
Commits
a9c4163c
Commit
a9c4163c
authored
Apr 28, 2022
by
W.D.R.P. Sandeepa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change route
parent
2464f719
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
20 deletions
+69
-20
API/app.py
API/app.py
+12
-1
API/model/__pycache__/colorModel.cpython-39.pyc
API/model/__pycache__/colorModel.cpython-39.pyc
+0
-0
API/model/__pycache__/userModel.cpython-39.pyc
API/model/__pycache__/userModel.cpython-39.pyc
+0
-0
API/model/colorModel.py
API/model/colorModel.py
+11
-2
frontend/src/screen/activity/Black.js
frontend/src/screen/activity/Black.js
+45
-16
frontend/src/screen/activity/White.js
frontend/src/screen/activity/White.js
+1
-1
No files found.
API/app.py
View file @
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)
...
...
API/model/__pycache__/colorModel.cpython-39.pyc
View file @
a9c4163c
No preview for this file type
API/model/__pycache__/userModel.cpython-39.pyc
View file @
a9c4163c
No preview for this file type
API/model/colorModel.py
View file @
a9c4163c
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
=
{
"id
coloractivityr
esult"
:
row
[
0
],
"id
ColorActivityR
esult"
:
row
[
0
],
"idcolorActivities"
:
row
[
1
],
"date"
:
row
[
2
],
"time"
:
row
[
3
],
...
...
frontend/src/screen/activity/Black.js
View file @
a9c4163c
...
...
@@ -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
:
-
1
5
0
}}
/
>
<
Image
source
=
{
require
(
'
../../assets/game/finish.png
'
)}
resizeMode
=
'
contain
'
style
=
{{
flex
:
.
9
,
marginLeft
:
-
1
2
0
}}
/
>
<
/TouchableOpacity
>
<
/View
>
...
...
frontend/src/screen/activity/White.js
View file @
a9c4163c
...
...
@@ -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
:
-
1
5
0
,
}}
/
>
<
Image
source
=
{
require
(
'
../../assets/game/finish.png
'
)}
resizeMode
=
'
contain
'
style
=
{{
flex
:
.
9
,
marginLeft
:
-
1
2
0
,
}}
/
>
<
/TouchableOpacity
>
<
/View
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment