Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ARFA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
ARFA
ARFA
Commits
c0b01136
Commit
c0b01136
authored
Nov 26, 2018
by
Rahul-chunduru
Browse files
Options
Browse Files
Download
Plain Diff
merge conflicts resolvedd
parents
edc4a72b
7882f369
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
3183 additions
and
101 deletions
+3183
-101
.vscode/settings.json
.vscode/settings.json
+3
-0
ARFA/ARFA_app/migrations/0001_initial.py
ARFA/ARFA_app/migrations/0001_initial.py
+243
-0
ARFA/ARFA_app/static/ARFA_app/QuestionImages/Q2sp4.png
ARFA/ARFA_app/static/ARFA_app/QuestionImages/Q2sp4.png
+0
-0
ARFA/ARFA_app/static/ARFA_app/favicon.ico
ARFA/ARFA_app/static/ARFA_app/favicon.ico
+0
-0
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/create_question.html
ARFA/ARFA_app/templates/ARFA_app/create_question.html
+2
-2
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
+0
-2
ARFA/ARFA_app/templates/ARFA_app/logout.html
ARFA/ARFA_app/templates/ARFA_app/logout.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/not_a_faculty.html
ARFA/ARFA_app/templates/ARFA_app/not_a_faculty.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/performance.html
ARFA/ARFA_app/templates/ARFA_app/performance.html
+142
-0
ARFA/ARFA_app/templates/ARFA_app/result.html
ARFA/ARFA_app/templates/ARFA_app/result.html
+2
-0
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
+5
-0
ARFA/ARFA_app/templates/ARFA_app/student_test_page.html
ARFA/ARFA_app/templates/ARFA_app/student_test_page.html
+0
-55
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
+27
-3
ARFA/ARFA_app/templates/ARFA_app/view_all_question.html
ARFA/ARFA_app/templates/ARFA_app/view_all_question.html
+2
-1
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
+18
-9
ARFA/ARFA_app/templates/base.html
ARFA/ARFA_app/templates/base.html
+2
-1
ARFA/ARFA_app/urls.py
ARFA/ARFA_app/urls.py
+2
-0
ARFA/ARFA_app/utilities.py
ARFA/ARFA_app/utilities.py
+83
-2
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+74
-23
ARFA/WITH_USER.sql
ARFA/WITH_USER.sql
+3
-0
ARFA/WITH_USER_question.sql
ARFA/WITH_USER_question.sql
+2572
-0
No files found.
.vscode/settings.json
0 → 100644
View file @
c0b01136
{
"python.linting.enabled"
:
false
}
\ No newline at end of file
ARFA/ARFA_app/migrations/0001_initial.py
0 → 100644
View file @
c0b01136
This diff is collapsed.
Click to expand it.
ARFA/ARFA_app/static/ARFA_app/QuestionImages/Q2sp4.png
0 → 100644
View file @
c0b01136
14.5 KB
ARFA/ARFA_app/static/ARFA_app/favicon.ico
0 → 100644
View file @
c0b01136
17.1 KB
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
View file @
c0b01136
...
...
@@ -9,7 +9,7 @@ Create Test
{%block body%}
<h1>
You CAN CREATE A Test HERE prof {{username}}
</h1>
<h1
style=
"text-align:center"
>
You CAN CREATE A Test HERE prof {{username}}
</h1>
<div
class=
"container"
>
<div
class=
"panel-default"
>
...
...
ARFA/ARFA_app/templates/ARFA_app/create_question.html
View file @
c0b01136
...
...
@@ -228,7 +228,7 @@ Create Question
{%endblock%}
{%block body%}
<h3>
You CAN CREATE A QUESTION HERE prof {{username}}
</h3>
<h3
style=
"text-align:center"
>
You CAN CREATE A QUESTION HERE prof {{username}}
</h3>
<div
class=
"container"
title=
"this is title"
>
<div
class=
"row"
>
<section>
...
...
@@ -310,7 +310,7 @@ Create Question
<li><button
type=
"button"
class=
"btn btn-default prev-step"
onclick=
"document.getElementById('l2').click() ; "
>
Previous
</button></li>
<li><button
type=
"button"
class=
"btn btn-default next-step"
onclick=
"document.getElementById('l4').click() ;"
>
Skip
</button></li>
<li><button
align=
"left"
type=
"button"
class=
"btn btn-primary"
id=
"addsubjectiveque"
onclick=
"intend_to_add_img() ; post()"
>
Add an image
</button></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-info-full next-step"
onclick=
"
step3()"
>
Save and continue
</button></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-info-full next-step"
onclick=
"
post()"
>
Post Question
</button></li>
</ul>
...
...
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
View file @
c0b01136
...
...
@@ -26,8 +26,6 @@ function submitExam()
var
countDownDate
=
new
Date
(
{{
end_time
}}
);
countDownDate
.
setMonth
(
countDownDate
.
getMonth
()
-
1
)
;
countDownDate
.
setMonth
(
countDownDate
.
getMonth
()
-
1
)
;
countDownDate
.
setMonth
(
countDownDate
.
getMonth
()
-
1
)
;
console
.
log
(
countDownDate
)
;
// Update the count down every 1 second
var
x
=
setInterval
(
function
()
{
...
...
ARFA/ARFA_app/templates/ARFA_app/logout.html
View file @
c0b01136
...
...
@@ -12,7 +12,7 @@ Logout
{%endblock%}
{%block body%}
<h3
class=
"myh3 deepshd"
>
You have succesfully logged out
</h3>
<h3
style=
"text-align:center"
class=
"myh3 deepshd"
>
You have succesfully logged out
</h3>
<!-- <div class="container">
<centre>
<h1> You have succesfully logged out</h1>
...
...
ARFA/ARFA_app/templates/ARFA_app/not_a_faculty.html
View file @
c0b01136
...
...
@@ -7,5 +7,5 @@ View All Question
{%endblock%}
{%block body%}
<h1>
You are not authorized for this action {{username}}
</h1>
<h1
style=
"text-align:center"
>
You are not authorized for this action {{username}}
</h1>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/performance.html
0 → 100644
View file @
c0b01136
{%extends 'base2.html'%}
{%block title%}
View personal Question
{%endblock%}
{%block head%}
<script
type=
"text/javascript"
src=
"https://www.google.com/jsapi"
></script>
<script
type=
"text/javascript"
>
google
.
load
(
'
visualization
'
,
'
1.0
'
,
{
'
packages
'
:[
'
corechart
'
]});
google
.
setOnLoadCallback
(
drawChart
);
function
drawChart
()
{
var
data
=
new
google
.
visualization
.
DataTable
();
// data.addColumn('string', 'Number');
data
.
addColumn
(
'
string
'
,
'
bin
'
);
data
.
addColumn
(
'
number
'
,
'
Count
'
);
// data.addRows( [['100',10],['90',9],['80',8]] );
data
.
addRows
(
{{
distribution
|
safe
}}
);
console
.
log
(
data
)
var
chart
=
new
google
.
visualization
.
ColumnChart
(
document
.
getElementById
(
'
chart_div
'
));
chart
.
draw
(
data
,
{
width
:
500
,
height
:
300
,
title
:
"
Scores Distribution
"
});
}
</script>
{%endblock%}
{%block body%}
<h1
style=
"text-align:center"
>
Test Performance
</h1>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
>
<div
class=
"container"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Test Stats
</h3>
</div>
<ul
class=
"list-group"
>
<li
class=
"list-group-item"
>
<div
class=
"row toggle"
>
<div
id=
"c1"
class=
"col-xs-10"
style=
"float:left;width:50%"
>
<p>
Average Score : {{test_aggregates.avg_marks}}
</p>
<p>
Best Score : {{test_aggregates.max_marks}}
</p>
<p>
Minimum score : {{test_aggregates.max_marks}}
</p>
<p>
Students appeared : {{test_aggregates.students_appeared}}
</p>
</div>
<div
class=
"col-xs-10"
style=
"float: right;width:50%"
id=
"chart_div"
>
</div>
</div>
<!-- <div>
<hr></hr>
</div> -->
</li>
</ul>
<!-- <div id="chart_div" > </div> -->
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Student Performance
</h3>
</div>
<ul
class=
"list-group"
>
{%for p in student_performance%}
<li
class=
"list-group-item"
>
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
<p>
student: {{p.student_id}}
</p>
<p>
rank: {{p.rank}}
</p>
<p>
Score: {{p.marks}}
</p>
</div>
</div>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<!-- <ul>
{%for option in question.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>
</li>
{%else%}
<li>
{{option.option_text}}
</li>
{%endif%}
{%endfor%}
</ul> -->
<!-- </div> -->
<!-- </div> -->
</li>
{%endfor%}
</ul>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Per Question stats
</h3>
</div>
<ul
class=
"list-group"
>
{%for q in question_stats%}
<li
class=
"list-group-item"
>
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
<p>
Difficulty set: {{q.difficulty_set}}
</p>
<p>
Difficulty observed: {{q.difficulty_observed}}
</p>
<p>
Question: {{q.question_text}}
</p>
</div>
</div>
<div>
<div>
<hr></hr>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%if option.is_answer %}
<li>
<p
style=
"color: green"
>
{{option.option_text}}
</p>
</li>
{%else%}
<li>
{{option.option_text}}
</li>
{%endif%}
{%endfor%}
</ul>
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</li>
{%endfor%}
</ul>
</div>
</div>
{%endblock%}
ARFA/ARFA_app/templates/ARFA_app/result.html
View file @
c0b01136
...
...
@@ -5,6 +5,8 @@ profile
{%block body%}
<h1
style=
"text-align:center"
>
Test Successfully Recorded
</h1>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
View file @
c0b01136
...
...
@@ -52,6 +52,11 @@ My Tests
<input
name=
"testID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<button
type=
"submit"
class=
"btn btn-login float-right"
style=
"margin-top: 10px ;margin-right: 40px"
>
Load Test
</button>
</form>
<form
method=
"POST"
action=
"viewTestPerformance"
>
{% csrf_token %}
<input
name=
"test_ID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<button
type=
"submit"
class=
"btn btn-login float-right"
style=
"margin-top: 10px ;margin-right: 40px"
>
View Results
</button>
</form>
</div>
</div>
{% endfor %}
...
...
ARFA/ARFA_app/templates/ARFA_app/student_test_page.html
deleted
100644 → 0
View file @
edc4a72b
{%extends 'base2.html'%}
{%block head%}
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"
>
MathJax
.
Hub
.
Config
({
tex2jax
:
{
inlineMath
:
[[
'
$
'
,
'
$
'
],
[
'
\\
(
'
,
'
\\
)
'
]]}});
</script>
{%endblock%}
{%block title%}
View personal Question
{%endblock%}
{%block body%}
<h1>
You CAN VIEW all your tests HERE student {{username}}
</h1>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
>
<div
class=
"container"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
LIST OF QUESTIONS
</h3>
</div>
<ul
class=
"list-group"
>
<!-- <ul> -->
{%for question in questions%}
<li
class=
"list-group-item"
>
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
{{question.question_text}}
</div>
</div>
<div>
<hr></hr>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in question.option_details%}
<!-- <div class="col-xs-1"> -->
<li>
{{option.is_answer}}
<!-- </div> -->
<!-- <div class="col-xs-5"> -->
{{option.option_text}}
<!-- </div> -->
</li>
{%endfor%}
</ul>
<!-- </div> -->
<!-- </div> -->
</div>
</li>
{%endfor%}
</ul>
</div>
</div>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
View file @
c0b01136
{%extends 'base2.html'%}
{%block title%}
View
All Test
View
personal Question
{%endblock%}
{%block body%}
<h1>
You CAN VIEW ALL Test HERE prof {{username}}
</h1>
<h1
style=
"text-align:center"
>
You CAN VIEW all tests prof {{username}}
</h1>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
>
<div
class=
"container"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
LIST OF TESTS
</h3>
</div>
<ul
class=
"list-group"
>
<!-- <ul> -->
{%for test in tests%}
<li
class=
"list-group-item"
>
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
{{test.test_name}}
</div>
</div>
<div>
<hr></hr>
</div>
</li>
{%endfor%}
</ul>
</div>
</div>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/view_all_question.html
View file @
c0b01136
{%extends 'base2.html'%}
{%block title%}
View all Question
{%endblock%}
{%block body%}
<h1>
You CAN VIEW all questions QUESTION HERE prof {{username}}
</h1>
<h1
style=
"text-align:center"
>
You CAN VIEW all questions QUESTION HERE prof {{username}}
</h1>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
>
<div
class=
"container"
>
<div
class=
"panel-default"
>
...
...
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
View file @
c0b01136
{%extends 'base2.html'%}
{%block head%}
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"
>
MathJax
.
Hub
.
Config
({
tex2jax
:
{
inlineMath
:
[[
'
$
'
,
'
$
'
],
[
'
\\
(
'
,
'
\\
)
'
]]}});
</script>
{%endblock%}
{%block title%}
View personal Question
{%endblock%}
{%block body%}
<h1>
You CAN VIEW your tests prof {{username}}
</h1>
<h1
style=
"text-align:center"
>
You CAN VIEW your tests prof {{username}}
</h1>
<link
rel=
"stylesheet"
href=
"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
>
<div
class=
"container"
>
<div
class=
"panel-default"
>
...
...
@@ -25,9 +18,25 @@ View personal Question
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
{{test.test_name}}
<p>
<h4>
{{test.test_name}}
</h4>
</p>
<p>
Start Time : {{test.start_time}}
</p>
<p>
Duration : {{test.duration}}
</p>
<p>
Maximum marks : {{test.max_marks}}
</p>
</div>
<form
method=
"POST"
action=
"viewTestPerformance"
>
{% csrf_token %}
<input
name=
"test_ID"
value=
"{{test.test_id}}"
type=
"hidden"
>
<button>
View Performence
</button>
</form>
<!-- <form method="POST" action="EditTest">
{% csrf_token %}
<input name="test_ID" value="{{test.test_ID}}" type="hidden">
<button>Edit Test</button>
</form> -->
</div>
<div>
<hr></hr>
</div>
...
...
ARFA/ARFA_app/templates/base.html
View file @
c0b01136
...
...
@@ -4,7 +4,7 @@
<head>
<!-- Latest compiled and minified CSS -->
{% load static %}
<link
rel=
"icon"
href=
"{% static 'ARFA_app/favicon.ico' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'ARFA_app/lib/bootstrap-3.3.7-dist/css/bootstrap.min.css' %}"
integrity=
"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin=
"anonymous"
>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
<script
src=
"{% static 'ARFA_app/lib/jquery/jquery-3.3.1.min.js' %}"
></script>
...
...
@@ -22,6 +22,7 @@
{% load static %}
<link
rel=
"stylesheet"
href=
"{% static 'ARFA_app/style.css' %}"
type=
"text/css"
>
<script
type=
"text/javascript"
src=
"{% static 'ARFA_app/lib/MathJax-2.7.5/MathJax.js' %}"
>
MathJax
.
Hub
.
Config
({
tex2jax
:
{
inlineMath
:
[[
'
$
'
,
'
$
'
],
[
'
\\
(
'
,
'
\\
)
'
]]}});
</script>
<script
type=
"text/javascript"
src=
"{% static 'ARFA_app/lib/MathJax-2.7.5/config/TeX-MML-AM_CHTML-full.js' %}"
>
</script>
...
...
ARFA/ARFA_app/urls.py
View file @
c0b01136
...
...
@@ -27,5 +27,7 @@ urlpatterns=[
url
(
r'^reg'
,
views
.
reg
),
url
(
r'^studentTestHome'
,
views
.
studentTestHome
),
url
(
r'^loadStudentTest'
,
views
.
loadStudentTest
),
url
(
r'^viewTestPerformance'
,
views
.
analyse_test
),
]
ARFA/ARFA_app/utilities.py
View file @
c0b01136
...
...
@@ -21,6 +21,7 @@ from django.db.models import F
from
pprint
import
pprint
import
datetime
def
evaluate
(
responses
,
otherData
):
"""responses contains a list of dicts of the form {q_ID: [option1, option2 ..]}
other data contains any other data necessary for evaluation such as testID and studentID"""
...
...
@@ -121,8 +122,89 @@ def get_all_questions(request):
"ARFA_app_options" as o,"ARFA_app_subject" as s
WHERE ( q.faculty_id =
%
s or q.visibility='public' ) and s."subject_ID" = q."subject_ID_id" and q."q_ID" = o."q_ID_id"
order by s.subject,q_ID '''
,[
args
[
'username'
]])
res
=
get_questions_dict
(
cursor
)
return
res
def
result_analysis
(
request
,
test_ID
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT student_id,total_marks as marks,rank
FROM "ARFA_app_takes"
WHERE "test_ID_id" =
%
s
order by total_marks desc '''
,[
test_ID
])
rows
=
cursor
.
fetchall
()
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res_stud
=
[]
for
val
in
rows
:
res_stud
.
append
(
dict
(
zip
(
columns
,
val
)))
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT avg(total_marks) as avg_marks,min(total_marks) as min_marks
,max(total_marks) as max_marks, count(student_id) as students_appeared
FROM "ARFA_app_takes"
WHERE "test_ID_id" =
%
s'''
,[
test_ID
])
rows
=
cursor
.
fetchall
()
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res_agg
=
dict
(
zip
(
columns
,
rows
[
0
]))
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT floor(total_marks/10) as left_bin,count(student_ID) as cnt
FROM "ARFA_app_takes"
WHERE "test_ID_id" =
%
s
GROUP BY total_marks/10
order by left_bin'''
,[
test_ID
])
hist
=
cursor
.
fetchall
()
y
=
0
if
hist
!=
[]:
y
=
int
(
list
(
hist
[
-
1
])[
0
])
hist
=
[
[
str
(
str
(
int
(
x
[
0
]))
+
"-"
+
str
(
int
(
x
[
0
])
+
10
)),
int
(
x
[
1
])]
for
x
in
hist
]
y
=
y
+
10
for
i
in
range
(
15
):
hist
.
append
([
str
(
str
(
y
)
+
"-"
+
str
(
y
+
10
)),
0
])
y
=
y
+
10
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT q."q_ID" as q_ID,q.question_text,q.difficulty_set,
q.difficulty_observed,s.subject,o."option_Value" as option_details,
o."is_Answer"
FROM "ARFA_app_contains" as c,"ARFA_app_question" as q,
"ARFA_app_options" as o, "ARFA_app_subject" as s
WHERE o."q_ID_id" = q."q_ID" and c."q_ID_id" = q."q_ID" and q."subject_ID_id" = s."subject_ID"
and c."test_ID_id" =
%
s
ORDER BY s.subject,q.difficulty_observed desc,o."q_ID_id" '''
,[
test_ID
])
# rows = cursor.fetchall()
# print rows
# columns = [col[0] for col in cursor.description]
# q_stats = []
# for val in rows:
# q_stats.append(dict(zip(columns,val)))
q_stats
=
get_questions_dict
(
cursor
)
print
q_stats
args
=
{
"student_performance"
:
res_stud
,
"test_aggregates"
:
res_agg
,
"question_stats"
:
q_stats
,
"distribution"
:
hist
}
return
args
def
get_questions_dict
(
cursor
):
rows
=
cursor
.
fetchall
()
# print(len(rows))
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res
=
[]
options_so_far
=
[]
...
...
@@ -146,7 +228,6 @@ def get_all_questions(request):
options_so_far
.
append
({
"option_text"
:
val
[
-
2
],
"is_answer"
:
val
[
-
1
]})
if
not
(
first
):
preval
[
-
1
]
=
options_so_far
# preval[1] = "q"+str(preval[1])
t
=
dict
(
zip
(
columns
[:
-
1
],
preval
))
res
.
append
(
t
)
return
res
\ No newline at end of file
ARFA/ARFA_app/views.py
View file @
c0b01136
...
...
@@ -14,6 +14,7 @@ from .models import Evaluation
from
.
import
utilities
from
.utilities
import
evaluate
from
.
import
forms
from
.utilities
import
result_analysis
from
.
import
tasks
from
django.http
import
QueryDict
...
...
@@ -29,6 +30,7 @@ from .forms import ImageFileUploadForm
from
django.http
import
JsonResponse
import
datetime
def
login
(
request
):
# This is the Login page and checks if anyone is already logged in and redirects accordingly
if
(
request
.
session
.
get
(
'session'
,
None
)
==
True
):
...
...
@@ -74,17 +76,20 @@ def reg(request):
if
(
request
.
method
==
"POST"
):
role
=
request
.
POST
[
'role'
]
data
=
{
'username'
:
request
.
POST
[
'username'
],
'name'
:
request
.
POST
[
'name'
],
'email_ID'
:
request
.
POST
[
'email_ID'
],
'address'
:
request
.
POST
[
'address'
],
'password'
:
request
.
POST
[
'password'
],
'phone_number'
:
request
.
POST
[
'phone_number'
]}
if
(
role
==
"Student"
):
print
"Student with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Student
(
**
data
)
s
.
save
()
else
:
data
[
'salary'
]
=
0
data
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
request
.
POST
[
'subject_ID'
])
.
get
()
print
"Faculty with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Faculty
(
**
data
)
s
.
save
()
try
:
if
(
role
==
"Student"
):
print
"Student with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Student
(
**
data
)
s
.
save
()
else
:
data
[
'salary'
]
=
0
data
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
request
.
POST
[
'subject_ID'
])
.
get
()
print
"Faculty with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Faculty
(
**
data
)
s
.
save
()
except
:
print
"registration failed"
return
redirect
(
'/arfa/register'
)
else
:
return
redirect
(
'/arfa'
)
...
...
@@ -373,7 +378,7 @@ def result(request):
utilities
.
evaluate
(
responses
,
{
'username'
:
request
.
session
[
'username'
],
'testID'
:
responseObj
.
test_ID_id
})
return
HttpResponse
(
"Result page should be here"
)
return
studentTestHome
(
request
)
...
...
@@ -547,15 +552,6 @@ def create_Test(request):
print
"testRanks being called
\n\n\n\n
"
return
view_personal_Test
(
request
)
def
view_all_Test
(
request
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
if
(
request
.
session
.
get
(
'role'
,
None
)
!=
"faculty"
):
return
render
(
request
,
'ARFA_app/not_a_faculty.html'
,
request
.
session
.
get
(
'args'
,
None
))
if
request
.
method
==
'POST'
:
args
=
{
'username'
:
request
.
session
[
'username'
],
'is_session'
:
True
}
return
render
(
request
,
'ARFA_app/view_all_Test.html'
,
args
)
...
...
@@ -568,7 +564,6 @@ def add_question(request):
try
:
question_data
=
dict
(
json
.
loads
(
request
.
POST
[
'client_response'
]))
args
=
question_data
[
'question_data'
]
print
args
[
'question_text'
]
if
args
[
'question_text'
]
==
''
:
...
...
@@ -577,8 +572,11 @@ def add_question(request):
args
[
'faculty'
]
=
models
.
Faculty
.
objects
.
filter
(
username
=
request
.
session
[
'username'
])
.
get
()
print
args
[
'faculty'
]
options
=
question_data
[
'options_details'
]
print
options
args
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
args
[
'subject_ID'
])
.
get
()
print
args
[
'subject_ID'
]
flag
=
False
for
i
in
range
(
0
,
len
(
options
)):
if
options
[
str
(
i
)][
'option_Value'
]:
...
...
@@ -586,8 +584,11 @@ def add_question(request):
break
if
not
(
flag
):
return
HttpResponse
(
json
.
dumps
({
'status'
:
'Failed'
,
'reason'
:
'No correct option provided'
}))
print
args
question
=
models
.
Question
(
**
args
)
print
question
question
.
save
()
print
"saved"
for
i
in
range
(
0
,
len
(
options
)):
option
=
models
.
Options
(
q_ID
=
question
,
option_Value
=
options
[
str
(
i
)][
'option_Value'
],
is_Answer
=
options
[
str
(
i
)][
'is_Answer'
],
option_ID
=
options
[
str
(
i
)][
'id'
])
...
...
@@ -605,7 +606,7 @@ def view_personal_Test(request):
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT t."test_ID" as test_ID,t.test_name,t.visibility_student,
t.ownership,t.expected_time_for_completion,t.start_time,t.max_marks
t.ownership,t.expected_time_for_completion
as duration
,t.start_time,t.max_marks
FROM "ARFA_app_created_by" as c,
"ARFA_app_test" as t
WHERE c."test_ID_id" = t."test_ID" and c.faculty_id =
%
s
...
...
@@ -620,6 +621,56 @@ def view_personal_Test(request):
return
render
(
request
,
'ARFA_app/view_personal_Test.html'
,
args
)
def
view_all_Test
(
request
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
if
(
request
.
session
.
get
(
'role'
,
None
)
!=
"faculty"
):
return
render
(
request
,
'ARFA_app/not_a_faculty.html'
,
request
.
session
.
get
(
'args'
,
None
))
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT t."test_ID" as test_ID,t.test_name,t.visibility_student,
t.ownership,t.expected_time_for_completion,t.start_time,t.max_marks
FROM "ARFA_app_test" as t
WHERE t.ownership = 'public' or t.start_time < current_timestamp
order by t.start_time desc '''
)
rows
=
cursor
.
fetchall
()
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res
=
[]
for
val
in
rows
:
res
.
append
(
dict
(
zip
(
columns
,
val
)))
args
=
{
'username'
:
request
.
session
[
'username'
],
'tests'
:
res
}
args
[
'is_session'
]
=
True
return
render
(
request
,
'ARFA_app/view_all_Test.html'
,
args
)
def
analyse_test
(
request
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
test_ID
=
0
print
request
.
POST
if
request
.
method
==
"GET"
:
test_ID
=
request
.
GET
[
"test_ID"
]
if
request
.
method
==
"POST"
:
test_ID
=
request
.
POST
[
"test_ID"
]
print
"test_ID"
print
test_ID
test
=
models
.
Test
.
objects
.
filter
(
test_ID
=
test_ID
,
start_time__lte
=
datetime
.
timedelta
(
minutes
=
5
)
+
datetime
.
datetime
.
now
()
-
F
(
'expected_time_for_completion'
))
.
all
()
# n = models.Created_BY().objects.filter(test_ID=test).all()
print
datetime
.
timedelta
(
minutes
=
5
)
+
datetime
.
datetime
.
now
()
-
F
(
'expected_time_for_completion'
)
if
len
(
test
)
==
0
:
return
HttpResponse
(
"test does not exist/not completed"
)
# if test[0].start_time < datetime.datetime.now():
args
=
result_analysis
(
request
,
test_ID
)
args
.
update
(
request
.
session
.
get
(
'args'
,
None
))
return
render
(
request
,
'ARFA_app/performance.html'
,
args
)
def
addimage
(
request
):
if
request
.
method
==
'POST'
:
...
...
ARFA/WITH_USER.sql
View file @
c0b01136
-- psql -h localhost -p 5430 -d arfa_database < <dump_file.sql>
--
-- PostgreSQL database dump
--
...
...
ARFA/WITH_USER_question.sql
0 → 100644
View file @
c0b01136
This diff is collapsed.
Click to expand it.
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