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
36f5e697
Commit
36f5e697
authored
May 02, 2022
by
Lihinikaduwa D.N.R.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created a API to Get Read Result
parent
3863768c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
166 additions
and
41 deletions
+166
-41
API/app.py
API/app.py
+15
-3
API/model/__pycache__/readModel.cpython-39.pyc
API/model/__pycache__/readModel.cpython-39.pyc
+0
-0
API/model/readModel.py
API/model/readModel.py
+3
-15
frontend/src/router/router.js
frontend/src/router/router.js
+25
-13
frontend/src/screen/Read.js
frontend/src/screen/Read.js
+8
-8
frontend/src/screen/reading/advanced/ReadActivityFish.js
frontend/src/screen/reading/advanced/ReadActivityFish.js
+17
-0
frontend/src/screen/reading/basic/ReadActivityHe.js
frontend/src/screen/reading/basic/ReadActivityHe.js
+2
-2
frontend/src/screen/reading/result/ReadResults.js
frontend/src/screen/reading/result/ReadResults.js
+96
-0
No files found.
API/app.py
View file @
36f5e697
...
...
@@ -10,8 +10,6 @@ import random
import
os
from
API.model.readModel
import
*
from
API.model.userModel
import
*
from
API.model.readModel
import
get_reading_activities
from
API.routers.router
import
funtion_one
# from backend.IT18218640.keyword_spotting_service import Keyword_Spotting_service
...
...
@@ -164,7 +162,7 @@ def reading_session(userId):
return
make_response
(
body
)
@
app
.
route
(
"/
reading
Session/<readingToken>"
,
methods
=
[
'PUT'
])
@
app
.
route
(
"/
update
Session/<readingToken>"
,
methods
=
[
'PUT'
])
def
reading_session_status_update
(
readingToken
):
assert
readingToken
==
request
.
view_args
[
'readingToken'
]
token
=
readingToken
...
...
@@ -211,5 +209,19 @@ def get_completed_levels(userId):
return
make_response
(
body
)
@
app
.
route
(
"/result/<userId>"
,
methods
=
[
'GET'
])
def
reading_result
(
userId
):
assert
userId
==
request
.
view_args
[
'userId'
]
result
=
get_reading_result
(
userId
)
response
=
{
"data"
:
result
,
"message"
:
"Success"
,
"status"
:
200
}
body
=
jsonify
(
response
)
return
make_response
(
body
)
if
__name__
==
"__main__"
:
app
.
run
(
host
=
'192.168.1.101'
)
API/model/__pycache__/readModel.cpython-39.pyc
View file @
36f5e697
No preview for this file type
API/model/readModel.py
View file @
36f5e697
...
...
@@ -3,21 +3,9 @@ from flask import jsonify
from
API.util.util
import
getUUID
def
get_reading_activities
():
data_dic
=
[]
qry
=
'SELECT * FROM reading'
result
=
get_all_data
(
qry
)
for
row
in
result
:
ob
=
{
"id"
:
row
[
0
],
"round"
:
row
[
1
],
}
data_dic
.
append
(
ob
)
return
jsonify
(
data_dic
)
def
get_reading_result
(
userId
):
qry
=
'SELECT * FROM reading WHERE userId = "{}"'
.
format
(
userId
)
return
get_data
(
qry
)
def
save_activity_details
(
userId
,
word
,
token
,
level
,
triedCount
):
...
...
frontend/src/router/router.js
View file @
36f5e697
...
...
@@ -71,6 +71,8 @@ import AdvanceLevelStart from '../screen/memory/AdvanceLevelStart';
import
Sam
from
'
../screen/sample/sam
'
;
import
Progress
from
'
../screen/Progress
'
;
import
ReadActivityFish
from
'
../screen/reading/advanced/ReadActivityFish
'
;
import
ReadActivityDog
from
'
../screen/reading/advanced/ReadActivityDog
'
;
const
Stack
=
createNativeStackNavigator
();
...
...
@@ -181,6 +183,16 @@ const AppRouter = () => {
name
=
"
ReadActivityBird
"
component
=
{
ReadActivityBird
}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
name
=
"
ReadActivityFish
"
component
=
{
ReadActivityFish
}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
name
=
"
ReadActivityDog
"
component
=
{
ReadActivityDog
}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
name
=
"
ColorResult
"
...
...
@@ -192,7 +204,7 @@ const AppRouter = () => {
options
=
{{
title
:
'
Memory Games
'
,
headerTintColor
:
'
white
'
,
headerStyle
:
{
backgroundColor
:
Colors
.
primary
}
headerStyle
:
{
backgroundColor
:
Colors
.
primary
}
,
}}
/
>
<
Stack
.
Screen
...
...
@@ -276,44 +288,44 @@ const AppRouter = () => {
}}
/
>
<
Stack
.
Screen
name
=
'
MemoryResult
'
name
=
"
MemoryResult
"
component
=
{
MemoryResult
}
options
=
{{
options
=
{{
headerShown
:
true
,
title
:
'
Results
'
,
headerTintColor
:
'
white
'
,
headerStyle
:
{
backgroundColor
:
Colors
.
primary
},
}}
}}
/
>
<
Stack
.
Screen
name
=
'
GameLevel
'
name
=
"
GameLevel
"
component
=
{
GameLevel
}
options
=
{{
options
=
{{
headerShown
:
true
,
title
:
'
Levels
'
,
headerTintColor
:
'
white
'
,
headerStyle
:
{
backgroundColor
:
Colors
.
primary
},
}}
}}
/
>
<
Stack
.
Screen
name
=
'
MediumLevelStart
'
name
=
"
MediumLevelStart
"
component
=
{
MediumLevelStart
}
options
=
{{
options
=
{{
headerShown
:
true
,
title
:
'
Medium Level
'
,
headerTintColor
:
'
white
'
,
headerStyle
:
{
backgroundColor
:
Colors
.
primary
},
}}
}}
/
>
<
Stack
.
Screen
name
=
'
AdvanceLevelStart
'
name
=
"
AdvanceLevelStart
"
component
=
{
AdvanceLevelStart
}
options
=
{{
options
=
{{
headerShown
:
true
,
title
:
'
Advance Level
'
,
headerTintColor
:
'
white
'
,
headerStyle
:
{
backgroundColor
:
Colors
.
primary
},
}}
}}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
}}
...
...
frontend/src/screen/Read.js
View file @
36f5e697
...
...
@@ -87,25 +87,25 @@ export default function Read() {
image
=
{
ImagePaths
.
roundOne
}
path
=
{
'
ReadActivityNo
'
}
/
>
{
level1
==
0
&&
(
<>
{
/* {
level1 == 0 && (
<>
*/
}
<
ReadCategory
title
=
{
'
Advanced
'
}
image
=
{
ImagePaths
.
roundTwo
}
path
=
{
'
ReadActivityDog
'
}
/
>
<
/
>
)}
{
/*
</>
)}
*/
}
{
level2
==
0
&&
(
<>
{
/* {
level2 == 0 && (
<>
*/
}
<
ReadCategory
title
=
{
'
Result & Summery
'
}
image
=
{
ImagePaths
.
summery
}
path
=
{
'
ReadActivity
'
}
/
>
<
/
>
)}
{
/*
</>
)}
*/
}
<
/TouchableOpacity
>
<
/ScrollView
>
<
/SafeAreaView
>
...
...
frontend/src/screen/reading/advanced/ReadActivityFish.js
View file @
36f5e697
...
...
@@ -46,6 +46,23 @@ export default function ReadActivityFish() {
},
})
.
then
(
res
=>
{
updateReadingSession
(
readingSession
);
})
.
catch
(
error
=>
{
console
.
log
(
error
);
});
};
const
updateReadingSession
=
readingSession
=>
{
Client
.
put
(
'
updateSession/
'
+
readingSession
,
{
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
})
.
then
(
res
=>
{
// AsyncStorage.removeItem('readingSession');
alert
(
'
Basic Level Completed
'
);
navigation
.
navigate
(
'
Read
'
);
})
.
catch
(
error
=>
{
...
...
frontend/src/screen/reading/basic/ReadActivityHe.js
View file @
36f5e697
...
...
@@ -55,14 +55,14 @@ export default function ReadActivityHe() {
const
updateReadingSession
=
readingSession
=>
{
console
.
log
(
'
fuck
'
);
Client
.
put
(
'
reading
Session/
'
+
readingSession
,
{
Client
.
put
(
'
update
Session/
'
+
readingSession
,
{
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
})
.
then
(
res
=>
{
AsyncStorage
.
removeItem
(
'
readingSession
'
);
//
AsyncStorage.removeItem('readingSession');
alert
(
'
Basic Level Completed
'
);
navigation
.
navigate
(
'
Read
'
);
})
...
...
frontend/src/screen/reading/result/ReadResults.js
0 → 100644
View file @
36f5e697
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
StyleSheet
,
View
,
Text
,
Pressable
,
ImageBackground
,
TouchableOpacity
,
Image
,
ScrollView
,
StatusBar
,
}
from
'
react-native
'
;
import
{
SafeAreaView
}
from
'
react-native-safe-area-context
'
;
import
Orientation
from
'
react-native-orientation-locker
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
import
BackButton
from
'
../../component/BackButton
'
;
import
TableList
from
'
../../component/TableList
'
;
import
axios
from
'
axios
'
;
import
Client
from
'
../../client/Client
'
;
const
webUrel
=
'
http://192.168.8.100:5000/getColorActivitiesResult
'
;
export
default
function
ReadResults
()
{
const
navigation
=
useNavigation
();
function
getColorResult
()
{
Client
.
get
(
'
reading
'
)
.
then
(
response
=>
{
// setNames(response.data);
console
.
log
(
response
.
data
);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
React
.
useEffect
(()
=>
{
StatusBar
.
setHidden
(
true
);
// getColorResult();
const
unsubscribe
=
navigation
.
addListener
(
'
focus
'
,
()
=>
{
// The screen is focused
// Call any action
Orientation
.
unlockAllOrientations
();
Orientation
.
lockToLandscape
();
});
return
unsubscribe
;
},
[
navigation
]);
return
(
<
SafeAreaView
style
=
{{
marginBottom
:
-
150
}}
>
<
ScrollView
>
<
View
>
<
ImageBackground
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../assets/result/21.jpg
'
)}
>
<
View
>
<
BackButton
path
=
"
Color
"
/>
<
/View
>
<
View
style
=
{
styles
.
container
}
>
<
Image
style
=
{
styles
.
logo
}
source
=
{
require
(
'
../../assets/result/title.png
'
)}
/
>
<
/View
>
<
View
style
=
{{
marginTop
:
-
70
}}
>
<
TableList
/>
<
/View
>
<
/ImageBackground
>
<
/View
>
<
/ScrollView
>
<
/SafeAreaView
>
);
}
const
styles
=
StyleSheet
.
create
({
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
,
},
container
:
{
// backgroundColor : '#fff',
marginTop
:
-
130
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
logo
:
{
marginTop
:
80
,
width
:
'
30%
'
,
height
:
'
30%
'
,
},
});
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