Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
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
2021-049
2021-049
Commits
6abcc971
Commit
6abcc971
authored
Nov 21, 2021
by
Gihan Tharaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quiz marks prediction with flask api
parent
98164579
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23473 additions
and
51 deletions
+23473
-51
BackEnd/WebBackEnd/models/studPer.model.js
BackEnd/WebBackEnd/models/studPer.model.js
+8
-5
BackEnd/WebBackEnd/package-lock.json
BackEnd/WebBackEnd/package-lock.json
+1370
-2
BackEnd/WebBackEnd/routes/studper.route.js
BackEnd/WebBackEnd/routes/studper.route.js
+53
-1
WebFrontEnd/smartcoach-frontend/package-lock.json
WebFrontEnd/smartcoach-frontend/package-lock.json
+21671
-39
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
...End/smartcoach-frontend/src/Components/Admin/Dashboard.js
+7
-2
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_stud_perf_details.js
...ch-frontend/src/Components/Admin/add_stud_perf_details.js
+47
-2
WebFrontEnd/smartcoach-frontend/src/Components/Admin/progress_students.js
...tcoach-frontend/src/Components/Admin/progress_students.js
+88
-0
WebFrontEnd/smartcoach-frontend/src/Components/Admin/view_progress.js
...smartcoach-frontend/src/Components/Admin/view_progress.js
+229
-0
WebFrontEnd/smartcoach-frontend/src/Images/female_avatar.png
WebFrontEnd/smartcoach-frontend/src/Images/female_avatar.png
+0
-0
WebFrontEnd/smartcoach-frontend/src/Images/male_avatar.png
WebFrontEnd/smartcoach-frontend/src/Images/male_avatar.png
+0
-0
No files found.
BackEnd/WebBackEnd/models/studPer.model.js
View file @
6abcc971
...
...
@@ -3,14 +3,17 @@ const Schema = mongoose.Schema;
let
PerformanceSchema
=
new
Schema
({
student_id
:
{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
ref
:
'
student
'
,
required
:
true
},
sex
:
{
type
:
Boolean
,
required
:
true
},
tutor_id
:
{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
ref
:
'
tutor
'
,
required
:
true
},
sex
:
{
type
:
Number
,
required
:
true
},
guardian
:
{
type
:
Number
,
required
:
true
},
study_time
:
{
type
:
Number
,
required
:
true
},
activities
:
{
type
:
Boolean
,
required
:
true
},
internet
:
{
type
:
Boolean
,
required
:
true
},
activities
:
{
type
:
Number
,
required
:
true
},
internet
:
{
type
:
Number
,
required
:
true
},
free_time
:
{
type
:
Number
,
required
:
true
},
absences
:
{
type
:
Number
,
required
:
true
},
g1
:
{
type
:
Number
,
required
:
true
},
g2
:
{
type
:
Number
,
required
:
true
}
g1
:
{
type
:
Number
},
g2
:
{
type
:
Number
},
g3
:
{
type
:
Number
}
},{
timestamps
:
true
});
...
...
BackEnd/WebBackEnd/package-lock.json
View file @
6abcc971
This diff is collapsed.
Click to expand it.
BackEnd/WebBackEnd/routes/studper.route.js
View file @
6abcc971
const
router
=
require
(
'
express
'
).
Router
();
const
StudPer
=
require
(
'
../models/studPer.model
'
);
const
axios
=
require
(
"
axios
"
);
// const tutor = require('../models/tutor.user.model');
router
.
route
(
'
/:id
'
).
get
((
req
,
res
)
=>
{
StudPer
.
find
({
tutor_id
:
req
.
params
.
id
}).
populate
(
'
student_id
'
)
.
then
(
progressstudents
=>
res
.
json
(
progressstudents
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
router
.
route
(
'
/store
'
).
post
((
req
,
res
)
=>
{
const
tutor_id
=
req
.
body
.
tutor_id
;
const
student_id
=
req
.
body
.
student_id
;
const
sex
=
req
.
body
.
sex
;
const
guardian
=
req
.
body
.
guardian
;
const
study_time
=
req
.
body
.
study_time
;
const
activities
=
req
.
body
.
activities
;
const
internet
=
req
.
body
.
internet
;
...
...
@@ -11,17 +22,21 @@ router.route('/store').post((req ,res) =>{
const
absences
=
req
.
body
.
absences
;
const
g1
=
req
.
body
.
g1
;
const
g2
=
req
.
body
.
g2
;
const
g3
=
req
.
body
.
g3
;
const
newPerformanceDetails
=
new
StudPer
({
tutor_id
,
student_id
,
sex
,
guardian
,
study_time
,
activities
,
internet
,
free_time
,
absences
,
g1
,
g2
g2
,
g3
});
newPerformanceDetails
.
save
()
...
...
@@ -29,4 +44,41 @@ router.route('/store').post((req ,res) =>{
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
router
.
route
(
'
/student/:id
'
).
get
((
req
,
res
)
=>
{
StudPer
.
find
({
student_id
:
req
.
params
.
id
}).
populate
(
'
student_id
'
)
.
then
(
students
=>
res
.
json
(
students
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
router
.
route
(
'
/predict_quiz_marks
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
called
"
);
let
predictDetails
=
{
sex
:
req
.
body
.
sex
,
guardian
:
req
.
body
.
guardian
,
studytime
:
req
.
body
.
studytime
,
activities
:
req
.
body
.
activities
,
internet
:
req
.
body
.
internet
,
freetime
:
req
.
body
.
freetime
,
absences
:
req
.
body
.
absences
,
G1
:
req
.
body
.
G1
,
G2
:
req
.
body
.
G2
,
}
console
.
log
(
predictDetails
);
let
options
=
{
uri
:
'
http://localhost:5000/predict_quiz_marks
'
,
body
:
JSON
.
stringify
(
predictDetails
),
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}
let
response
=
await
axios
.
post
(
options
.
uri
,
options
.
body
)
console
.
log
(
response
.
data
);
res
.
json
(
response
.
data
)
});
module
.
exports
=
router
;
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/package-lock.json
View file @
6abcc971
This diff is collapsed.
Click to expand it.
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
View file @
6abcc971
...
...
@@ -10,6 +10,8 @@ import Analytics from "./analytics";
import
studentRequest
from
'
./StudentRequestForClass
'
;
import
TestTeacher
from
"
../../Images/defaultimageicon.jpg
"
;
import
AddStudPer
from
'
./add_stud_perf_details
'
;
import
ProgressStudents
from
"
./progress_students
"
;
import
ViewProgress
from
"
./view_progress
"
;
export
default
class
Dashboard
extends
Component
{
...
...
@@ -460,10 +462,10 @@ export default class Dashboard extends Component {
<
/a
>
<
/li
>
<
li
>
<
a
href
=
"
#
"
>
<
NavLink
activeClassName
=
"
mm-active
"
to
=
{
"
/admin/studper/tutor/
"
+
this
.
state
.
user_id
}
>
<
i
className
=
"
metismenu-icon
"
><
/i
>
Progress
<
/
a
>
<
/
NavLink
>
<
/li
>
<
li
>
<
NavLink
activeClassName
=
'
mm-active
'
to
=
{
"
/admin/studper/add/
"
}
>
...
...
@@ -535,6 +537,9 @@ export default class Dashboard extends Component {
<
Route
path
=
"
/admin/classes/add
"
exact
component
=
{
AddClass
}
/
>
<
Route
path
=
"
/admin/classes/studentRequests
"
exact
component
=
{
studentRequest
}
/
>
<
Route
path
=
"
/admin/studper/add
"
exact
component
=
{
AddStudPer
}
/
>
<
Route
path
=
"
/admin/studper/tutor/:id
"
exact
component
=
{
ProgressStudents
}
/
>
<
Route
path
=
"
/admin/studper/student/:id
"
exact
component
=
{
ViewProgress
}
/
>
<
Route
path
=
"
/admin/predict_quiz_marks
"
exact
component
=
{
ViewProgress
}
/
>
<
/div
>
{
/* Footer */
}
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_stud_perf_details.js
View file @
6abcc971
...
...
@@ -9,18 +9,29 @@ export default class AddPerformanceDetails extends Component{
super
(
props
);
this
.
state
=
{
tutor_id
:
''
,
student_id
:
''
,
sex
:
''
,
guardian
:
''
,
study_time
:
''
,
activities
:
''
,
internet
:
''
,
free_time
:
''
,
absences
:
''
,
g1
:
''
,
g2
:
''
g2
:
''
,
g3
:
''
};
}
componentDidMount
()
{
const
tutor_id
=
localStorage
.
getItem
(
"
userID
"
);
this
.
setState
({
tutor_id
:
tutor_id
})
}
onChangeHandler
=
e
=>
{
this
.
setState
({
[
e
.
target
.
name
]:
e
.
target
.
value
...
...
@@ -31,20 +42,25 @@ export default class AddPerformanceDetails extends Component{
e
.
preventDefault
();
const
studPerfDetails
=
{
tutor_id
:
this
.
state
.
tutor_id
,
student_id
:
this
.
state
.
student_id
,
sex
:
this
.
state
.
sex
,
guardian
:
this
.
state
.
guardian
,
study_time
:
this
.
state
.
study_time
,
activities
:
this
.
state
.
activities
,
internet
:
this
.
state
.
internet
,
free_time
:
this
.
state
.
free_time
,
absences
:
this
.
state
.
absences
,
g1
:
this
.
state
.
g1
,
g2
:
this
.
state
.
g2
g2
:
this
.
state
.
g2
,
g3
:
this
.
state
.
g3
}
console
.
log
(
`Form submitted:`
);
console
.
log
(
`tutor_id:
${
this
.
state
.
tutor_id
}
`
);
console
.
log
(
`std_id:
${
this
.
state
.
student_id
}
`
);
console
.
log
(
`sex:
${
this
.
state
.
sex
}
`
);
console
.
log
(
`guardian:
${
this
.
state
.
guardian
}
`
);
console
.
log
(
`study_time:
${
this
.
state
.
study_time
}
`
);
console
.
log
(
`activities:
${
this
.
state
.
activities
}
`
);
console
.
log
(
`internet:
${
this
.
state
.
internet
}
`
);
...
...
@@ -52,6 +68,7 @@ export default class AddPerformanceDetails extends Component{
console
.
log
(
`absences:
${
this
.
state
.
absences
}
`
);
console
.
log
(
`G1:
${
this
.
state
.
g1
}
`
);
console
.
log
(
`G2:
${
this
.
state
.
g2
}
`
);
console
.
log
(
`G3:
${
this
.
state
.
g3
}
`
);
axios
.
post
(
configs
.
BASE_URL
+
'
/admin/studper/store
'
,
studPerfDetails
)
.
then
(
...
...
@@ -86,6 +103,13 @@ export default class AddPerformanceDetails extends Component{
<
form
onSubmit
=
{
this
.
onSubmitHandler
}
>
<
div
className
=
"
position-relative row form-group
"
>
<
label
htmlFor
=
"
stdId
"
className
=
"
col-sm-2 col-form-label
"
>
Tutor
ID
<
/label
>
<
div
className
=
"
col-sm-3
"
>
<
input
type
=
"
text
"
name
=
"
tutor_id
"
id
=
"
tutId
"
value
=
{
this
.
state
.
tutor_id
}
className
=
"
form-control
"
disabled
/>
<
/div
>
<
/div
>
<
div
className
=
"
position-relative row form-group
"
>
<
label
htmlFor
=
"
stdId
"
className
=
"
col-sm-2 col-form-label
"
>
Student
ID
<
/label
>
<
div
className
=
"
col-sm-3
"
>
...
...
@@ -106,6 +130,19 @@ export default class AddPerformanceDetails extends Component{
<
label
>
Female
/
Male
<
/label
>
<
/div
>
<
div
className
=
"
position-relative row form-group
"
>
<
label
htmlFor
=
"
guardian
"
className
=
"
col-sm-2 col-form-label
"
>
Guardian
<
/label
>
<
div
className
=
"
col-sm-3
"
>
<
select
defaultValue
=
""
className
=
"
form-control
"
name
=
"
guardian
"
onChange
=
{
this
.
onChangeHandler
}
>
<
option
disabled
=
{
true
}
value
=
""
>
Select
<
/option
>
<
option
value
=
"
1
"
>
Father
<
/option
>
<
option
value
=
"
0
"
>
Mother
<
/option
>
<
option
value
=
"
2
"
>
Other
<
/option
>
<
/select
>
<
/div
>
<
label
>
Guardian
of
the
student
<
/label
>
<
/div
>
<
div
className
=
"
position-relative row form-group
"
>
<
label
htmlFor
=
"
studyTime
"
className
=
"
col-sm-2 col-form-label
"
>
Study
Time
<
/label
>
<
div
className
=
"
col-sm-3
"
>
...
...
@@ -170,6 +207,14 @@ export default class AddPerformanceDetails extends Component{
<
label
>
Quiz
2
marks
obtained
by
the
student
<
/label
>
<
/div
>
<
div
className
=
"
position-relative row form-group
"
>
<
label
htmlFor
=
"
quiz3
"
className
=
"
col-sm-2 col-form-label
"
>
Quiz
3
Marks
<
/label
>
<
div
className
=
"
col-sm-3
"
>
<
input
type
=
"
number
"
min
=
"
0
"
max
=
"
20
"
name
=
"
g3
"
id
=
"
quiz3
"
className
=
"
form-control
"
onChange
=
{
this
.
onChangeHandler
}
/
>
<
/div
>
<
label
>
Quiz
3
marks
obtained
by
the
student
<
/label
>
<
/div
>
<
div
className
=
"
position-relative row form-group
"
>
<
div
className
=
"
col-sm-12
"
>
<
button
className
=
"
btn btn-primary
"
style
=
{{
width
:
"
150px
"
}}
type
=
"
submit
"
>
Save
Details
<
/button
>
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Admin/progress_students.js
0 → 100644
View file @
6abcc971
import
React
,
{
Component
}
from
"
react
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
axios
from
"
axios
"
;
import
*
as
configs
from
"
../../Config/config
"
;
import
MaleAvatar
from
'
../../Images/male_avatar.png
'
;
import
FemaleAvatar
from
'
../../Images/female_avatar.png
'
;
export
default
class
ProgressStudents
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
info
:
[],
};
}
componentDidMount
()
{
const
tutor_id
=
localStorage
.
getItem
(
"
userID
"
);
axios
.
get
(
configs
.
BASE_URL
+
'
/admin/studper/
'
+
tutor_id
)
.
then
(
response
=>
{
console
.
log
(
response
.
data
);
// const info = response.data;
this
.
setState
({
info
:
response
.
data
});
})
.
catch
(
error
=>
{
console
.
log
(
error
);
})
}
render
()
{
return
(
<
div
>
<
div
className
=
"
app-page-title
"
>
<
div
className
=
"
page-title-wrapper
"
>
<
div
className
=
"
page-title-heading
"
>
<
div
className
=
"
page-title-icon
"
>
<
i
className
=
"
pe-7s-display1 fa fa-line-chart
"
><
/i
>
<
/div
>
<
div
>
Students
List
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col-lg-12
"
>
<
div
className
=
"
main-card mb-3 card
"
>
<
div
className
=
"
card-body
"
>
<
table
className
=
"
mb-0 table table-striped
"
>
<
thead
>
<
tr
>
<
th
>
Student
Name
<
/th
>
<
th
>
Photo
<
/th
>
<
th
>
Details
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
this
.
state
.
info
.
map
((
student
)
=>
{
return
(
<
tr
>
<
td
>
{
student
.
student_id
.
student_name
}
<
/td
>
<
td
>
{
student
.
student_id
.
student_gender
==
'
Male
'
?
<
img
className
=
"
rounded-circle
"
src
=
{
MaleAvatar
}
style
=
{{
width
:
"
100px
"
,
height
:
"
100px
"
}}
/> : <img className="rounded-circle" src={FemaleAvatar} style={{width:"100px",height:"100px"}}/
>
}
<
/td
>
<
td
>
<
Link
style
=
{{
color
:
"
black
"
}}
to
=
{
"
/admin/studper/student/
"
+
student
.
student_id
.
_id
}
>
<
button
style
=
{{
width
:
"
auto
"
}}
className
=
"
btn btn-warning mr-1
"
>
Show
Progress
<
/button
>
<
/Link
>
<
/td
>
<
/tr
>
);
})}
<
/tbody
>
<
/table
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
// }
}
}
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Components/Admin/view_progress.js
0 → 100644
View file @
6abcc971
This diff is collapsed.
Click to expand it.
WebFrontEnd/smartcoach-frontend/src/Images/female_avatar.png
0 → 100644
View file @
6abcc971
7.94 KB
WebFrontEnd/smartcoach-frontend/src/Images/male_avatar.png
0 → 100644
View file @
6abcc971
6.33 KB
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