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
474784d5
Commit
474784d5
authored
Apr 29, 2022
by
Lihinikaduwa D.N.R.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read session and save save_activity_details done
parent
c460d9e0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
5 deletions
+26
-5
API/__pycache__/app.cpython-39.pyc
API/__pycache__/app.cpython-39.pyc
+0
-0
API/app.py
API/app.py
+17
-3
API/db/__pycache__/dbConnection.cpython-39.pyc
API/db/__pycache__/dbConnection.cpython-39.pyc
+0
-0
API/db/dbConnection.py
API/db/dbConnection.py
+0
-1
API/model/__pycache__/readModel.cpython-39.pyc
API/model/__pycache__/readModel.cpython-39.pyc
+0
-0
API/model/__pycache__/userModel.cpython-39.pyc
API/model/__pycache__/userModel.cpython-39.pyc
+0
-0
API/model/readModel.py
API/model/readModel.py
+9
-1
No files found.
API/__pycache__/app.cpython-39.pyc
View file @
474784d5
No preview for this file type
API/app.py
View file @
474784d5
...
...
@@ -3,7 +3,7 @@ from flask import Flask, redirect, url_for, render_template, request, jsonify, m
import
random
import
os
from
API.model.colorModel
import
get_color_activities1
,
get_color_activities2
,
get_color_activity_result
from
API.model.readModel
import
get_reading_activities
,
save_activity_details
from
API.model.readModel
import
get_reading_activities
,
save_activity_details
,
save_session_details
from
API.model.userModel
import
getUser
,
saveUserSession
from
API.model.colorModel
import
get_color_activities1
,
get_color_activities2
,
get_color_activity_result
,
storeResult
from
API.model.readModel
import
get_reading_activities
...
...
@@ -106,9 +106,9 @@ def predict():
# return jsonify("print")
# return "Print"
@
app
.
route
(
"/store"
,
methods
=
[
"POST"
])
def
store
():
req
=
request
.
get_json
()
value
=
req
[
'value'
]
date
=
req
[
'date'
]
...
...
@@ -123,6 +123,7 @@ def store():
print
(
e
)
return
e
# Read Function Route (IT)
...
...
@@ -170,6 +171,20 @@ def login():
return
make_response
(
body
)
@
app
.
route
(
"/readingSession"
,
methods
=
[
'POST'
])
def
reading_session
():
req
=
request
.
get_json
()
userId
=
req
[
'userId'
]
token
=
save_session_details
(
userId
,
1
)
data
=
{
"token"
:
token
,
"message"
:
"Success"
,
"status"
:
200
}
body
=
jsonify
(
data
)
return
make_response
(
body
)
@
app
.
route
(
"/reading"
,
methods
=
[
'POST'
])
def
reading
():
req
=
request
.
get_json
()
...
...
@@ -179,7 +194,6 @@ def reading():
level
=
req
[
'level'
]
triedCount
=
req
[
'triedCount'
]
result
=
save_activity_details
(
userId
,
word
,
token
,
level
,
triedCount
)
print
(
result
)
body
=
jsonify
(
word
)
return
make_response
(
body
)
...
...
API/db/__pycache__/dbConnection.cpython-39.pyc
View file @
474784d5
No preview for this file type
API/db/dbConnection.py
View file @
474784d5
...
...
@@ -32,7 +32,6 @@ def get_all_data(query):
return
result
def
insert_data_pandas_df
(
pd_df
,
table_name
):
db
=
create_con_pandas
()
pd_df
.
to_sql
(
name
=
table_name
,
con
=
db
,
if_exists
=
'append'
,
index
=
False
)
...
...
API/model/__pycache__/readModel.cpython-39.pyc
View file @
474784d5
No preview for this file type
API/model/__pycache__/userModel.cpython-39.pyc
View file @
474784d5
No preview for this file type
API/model/readModel.py
View file @
474784d5
from
API.db.dbConnection
import
get_all_data
,
insert
from
flask
import
jsonify
from
API.util.util
import
getUUID
def
get_reading_activities
():
data_dic
=
[]
...
...
@@ -24,3 +24,11 @@ def save_activity_details(userId, word, token, level, triedCount):
args
=
(
userId
,
word
,
token
,
level
,
triedCount
)
result
=
insert
(
qry
,
args
)
return
result
def
save_session_details
(
userId
,
status
):
token
=
getUUID
()
qry
=
'INSERT INTO readingSession (id,userId,token,status) VALUES (NULL,
%
s,
%
s,
%
s)'
args
=
(
userId
,
token
,
status
)
insert
(
qry
,
args
)
return
token
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