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
697b9501
Commit
697b9501
authored
Nov 27, 2018
by
Rahul-chunduru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more ui
parent
74b49c59
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
157 additions
and
63 deletions
+157
-63
ARFA/ARFA_app/models.py
ARFA/ARFA_app/models.py
+2
-2
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
+29
-14
ARFA/ARFA_app/templates/ARFA_app/create_question.html
ARFA/ARFA_app/templates/ARFA_app/create_question.html
+10
-1
ARFA/ARFA_app/templates/ARFA_app/faculty_home.html
ARFA/ARFA_app/templates/ARFA_app/faculty_home.html
+2
-2
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
+5
-3
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
+18
-4
ARFA/ARFA_app/templates/ARFA_app/view_all_question.html
ARFA/ARFA_app/templates/ARFA_app/view_all_question.html
+12
-2
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
+1
-2
ARFA/ARFA_app/templates/ARFA_app/view_personal_question.html
ARFA/ARFA_app/templates/ARFA_app/view_personal_question.html
+14
-12
ARFA/ARFA_app/utilities.py
ARFA/ARFA_app/utilities.py
+18
-4
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+46
-17
No files found.
ARFA/ARFA_app/models.py
View file @
697b9501
...
...
@@ -28,8 +28,8 @@ class Faculty(arfa_user):
class
Test
(
models
.
Model
):
test_ID
=
models
.
AutoField
(
primary_key
=
True
)
test_name
=
models
.
CharField
(
max_length
=
200
,
unique
=
True
)
visibility_student
=
models
.
CharField
(
max_length
=
20
)
ownership
=
models
.
CharField
(
max_length
=
20
)
#
visibility_student = models.CharField(max_length=20)
#
ownership = models.CharField(max_length=20)
expected_time_for_completion
=
models
.
DurationField
(
blank
=
True
)
start_time
=
models
.
DateTimeField
(
auto_now
=
False
,
auto_now_add
=
False
,
blank
=
False
)
max_marks
=
models
.
IntegerField
(
null
=
True
)
...
...
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
View file @
697b9501
...
...
@@ -58,7 +58,7 @@ Create Test
{%block body%}
<h1
style=
"text-align:center"
>
You CAN CREATE A Test HERE prof {{username}}
</h1>
<h1
style=
"text-align:center"
>
Create a test here
</h1>
<div
class=
"container"
>
<div
class=
"panel-default"
>
...
...
@@ -66,15 +66,19 @@ Create Test
<h3
class=
"panel-title"
>
Choose which questions are to be a part of the test
</h3>
</div>
<ul
class=
"list-group"
>
<!-- <ul> -->
<div>
<div
style=
"float:right ; "
>
Total Marks :
<p
id=
'total_marks'
></p>
<div
style=
"float:right ; margin-right: 30px "
>
Total Marks :
<p
id=
'total_marks'
style=
"float:right;"
></p>
</div>
<br/>
<br/>
<br/>
<div
style=
"float:right ; "
>
Number of Questions :
<p
id=
'num_questions'
></p>
<br/>
<br/>
<div
style=
"float:right ;
margin-right: 30px
"
>
Number of Questions :
<p
id=
'num_questions'
style=
"float:right;"
></p>
</div>
</div>
</div>
<form
method=
"POST"
action=
"create_Test"
>
{% csrf_token %}
{{ TestForm.as_p }}
...
...
@@ -83,16 +87,26 @@ Create Test
{%for question in questions%}
<li
class=
"list-group-item"
>
<div
class=
"row toggle"
>
<div
class=
"row toggle"
style=
"margin-left:10%"
>
<div
class=
"col-xs-10"
>
<input
type=
"checkbox"
value=
"True"
name =
"{{question.q_id}}"
id =
"{{question.q_id}}"
onclick=
"handleCheckBoxClick(this)"
posMarksID=
"{{question.q_id}}pos_marks"
>
<!-- link to posmarks in checkbox -->
{{question.question_text}} {{question.q_id}}
</br>
{{question.question_text}}
</br>
{%if question.ip%}
{%load static%}
<div
align=
"center"
>
<img
src =
"{% static "
"
%}{{
question
.
ip
|
slice:
"
16:
"
}}"
width=
"35%"
height=
"35%"
>
<p
style=
"margin-top:5px"
>
{{question.imdesc}}
</p>
</div>
{%endif%}
</div>
</div>
<div>
<div
style=
"margin-left:10%"
>
<hr></hr>
<ul>
{%for option in question.option_details%}
...
...
@@ -106,8 +120,7 @@ Create Test
</li>
{%endif%}
{%endfor%}
<label>
marks
<label
style=
"margin-top:10px; margin-right:5px"
>
marks
</label>
<!-- the id of checkboxes is q_id. I'm linking pos_marks to checkboxes
by id -->
<input
class =
"pos_marks"
type=
"number"
name=
"{{question.q_id}}"
...
...
@@ -117,17 +130,19 @@ Create Test
<input
type=
"number"
name=
"{{question.q_id}}"
min=
"-10"
max=
"0"
placeholder=
"-1"
step=
"0.25"
value=
"0"
>
</label>
</ul>
</div>
</li>
{%endfor%}
<div
style=
"float:right; margin-top: 10px; margin-right:20px "
>
<button
type=
"submit"
class=
"btn btn-login float-right"
>
Submit
</button>
</div>
</form>
</div>
</ul>
<
/div
>
<
br><br><br><br><br><br
>
</div>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/create_question.html
View file @
697b9501
...
...
@@ -110,7 +110,8 @@ function prevTab(elem) {
var
qtext
=
document
.
getElementById
(
'
qtext
'
).
value
;
question_data
[
'
subject_ID
'
]
=
subject
.
value
;
question_data
[
'
question_text
'
]
=
qtext
;
question_data
[
'
difficulty_set
'
]
=
document
.
getElementById
(
'
diff
'
).
value
;
question_data
[
'
difficulty_set
'
]
=
document
.
getElementById
(
'
diff
'
).
value
;
question_data
[
'
visibilility
'
]
=
document
.
getElementById
(
'
visible
'
).
value
;
console
.
log
(
question_data
)
;
document
.
getElementById
(
'
l2
'
).
click
()
;
}
...
...
@@ -292,6 +293,14 @@ Create Question
<label
style=
"margin-right:20px"
>
Specify question difficulty
</label>
<input
type=
"number"
name=
"quantity"
min=
"1"
max=
"10"
placeholder=
"5"
value=
"5"
id=
"diff"
>
</div>
<br>
<div
class=
"form-group col-lg-4"
>
<label
style=
"margin-right:20px;"
>
Specify question visibility
</label>
<select
name=
"visible"
id=
"visible"
>
<option
value=
"public"
>
Public
</option>
<option
value=
"private"
>
Private
</option>
</select>
</div>
</div>
<div
class=
"tab-pane"
role=
"tabpanel"
id=
"step2"
>
<h3>
Step 2 - Add some options
</h3>
...
...
ARFA/ARFA_app/templates/ARFA_app/faculty_home.html
View file @
697b9501
...
...
@@ -143,12 +143,12 @@ profile
</a>
<a
href=
"/arfa/view_personal_Test"
>
<center><button
type=
"button"
class=
"btn btn-lg btn-labeled btn-primary"
href=
"#"
style=
"margin-bottom: 15px;"
>
<span
class=
"btn-label"
><i
class=
"fa fa-eye-slash"
></i></span>
VIEW MY Test
<span
class=
"btn-label"
><i
class=
"fa fa-eye-slash"
></i></span>
VIEW MY Test
s
</button></center>
</a>
<a
href=
"/arfa/view_all_Test"
>
<center><button
type=
"button"
class=
"btn btn-lg btn-labeled btn-info"
href=
"#"
style=
"margin-bottom: 15px;"
>
<span
class=
"btn-label"
><i
class=
"fa fa-eye"
></i></span>
VIEW ALL Test
<span
class=
"btn-label"
><i
class=
"fa fa-eye"
></i></span>
VIEW ALL Test
s
</button></center>
</a>
...
...
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
View file @
697b9501
...
...
@@ -56,22 +56,24 @@ My Tests
<p><i>
Test Name
</i>
<b>
{{t.test_name}}
</b>
</p>
</div>
<div
style=
"float:right"
>
<form
method=
"POST"
action=
"loadStudentTest"
>
<div
class=
"row"
>
<form
method=
"POST"
action=
"loadStudentTest"
style=
"float:right;"
>
{% csrf_token %}
<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"
>
<form
method=
"POST"
action=
"viewTestPerformance"
style=
"float:left;"
>
{% csrf_token %}
{% if t.hasTaken is True %}
<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>
style=
"margin-top: 10px ;margin-right: 40px
; background-color: gray;
"
>
View Results
</button>
{% endif %}
</form>
</div>
</div>
</div>
{% endfor %}
...
...
ARFA/ARFA_app/templates/ARFA_app/view_all_Test.html
View file @
697b9501
{%extends 'base2.html'%}
{%block title%}
View personal Question
{%endblock%}
{%block body%}
<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"
>
<h1
style=
"text-align:center"
>
View all tests here
</h1>
<div
class=
"container"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
...
...
@@ -19,9 +17,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/ARFA_app/view_all_question.html
View file @
697b9501
...
...
@@ -20,10 +20,20 @@ View all Question
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
{{question.question_text}}
<p>
<b>
Question.
</b>
{{question.question_text}}
</p>
{%if question.ip%}
{%load static%}
<div
align=
"center"
>
<img
src =
"{% static "
"
%}{{
question
.
ip
|
slice:
"
16:
"
}}"
width=
"35%"
height=
"35%"
>
<p
style=
"margin-top:5px"
>
{{question.imdesc}}
</p>
</div>
{%endif%}
</div>
</div>
<div>
<div
class=
"col-xs-10"
>
<hr></hr>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
...
...
ARFA/ARFA_app/templates/ARFA_app/view_personal_Test.html
View file @
697b9501
...
...
@@ -4,8 +4,7 @@
View personal Question
{%endblock%}
{%block body%}
<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"
>
<h1
style=
"text-align:center"
>
View your tests here
</h1>
<div
class=
"container"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
...
...
ARFA/ARFA_app/templates/ARFA_app/view_personal_question.html
View file @
697b9501
...
...
@@ -9,18 +9,18 @@ p {
font-size
:
130%
}
</style>
<h2
align=
"center"
>
You CAN VIEW personal QUESTIONS HERE prof {{username}}
</h2>
<h2
align=
"center"
>
View personal questions here
</h2>
<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"
>
<div
class=
"panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
LIST OF QUESTIONS
</h3>
</div>
</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"
>
<p>
<b>
Question.
</b>
{{question.question_text}}
</p>
...
...
@@ -30,13 +30,14 @@ p {
<img
src =
"{% static "
"
%}{{
question
.
ip
|
slice:
"
16:
"
}}"
width=
"35%"
height=
"35%"
>
<p
style=
"margin-top:5px"
>
{{question.imdesc}}
</p>
</div>
</p>
</div>
{%endif%}
{%endif%}
</div>
</div>
</div>
<div>
<div
>
<hr></hr>
<ul>
{%for option in question.option_details%}
...
...
@@ -57,6 +58,7 @@ p {
</li>
{%endfor%}
</ul>
</div>
</div>
</div>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/utilities.py
View file @
697b9501
...
...
@@ -116,9 +116,11 @@ def get_all_questions(request):
# args = {'username':'mathura'}
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT s.subject,q."q_ID" as q_ID,q.question_text,q.topic,q.subtopic,q.source,
q.difficulty_set,q.visibility,q.ownership,o."option_Value" as option_details,
q.difficulty_set,q.visibility,q.ownership,q.image as ip , q."imageDesc" as imdesc,
o."option_Value" as option_details,
o."is_Answer"
FROM "ARFA_app_question" as q,
FROM ("ARFA_app_question" as u LEFT OUTER JOIN "ARFA_app_questionimage" as v ON
u."q_ID" = v."q_ID_id") as q,
"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'
]])
...
...
@@ -126,6 +128,15 @@ def get_all_questions(request):
return
res
def
get_difficulty
(
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
))
else
:
Diff
=
request
.
POST
[
'difficulty'
]
Questions
=
models
.
Questions
.
objects
.
filter
(
difficulty_set
=
Diff
)
def
result_analysis
(
request
,
test_ID
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
...
...
@@ -178,9 +189,12 @@ def result_analysis(request,test_ID):
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,
q.difficulty_observed,s.subject, q.image as ip , q."imageDesc" as imdesc,
o."option_Value" as option_details,
o."is_Answer"
FROM "ARFA_app_contains" as c,"ARFA_app_question" as q,
FROM "ARFA_app_contains" as c,
("ARFA_app_question" as u LEFT OUTER JOIN "ARFA_app_questionimage" as v ON
u."q_ID" = v."q_ID_id") 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
...
...
ARFA/ARFA_app/views.py
View file @
697b9501
...
...
@@ -460,7 +460,7 @@ def view_all_question(request):
args
=
{
'username'
:
request
.
session
[
'username'
],
'questions'
:
res
}
args
.
update
(
request
.
session
.
get
(
'args'
,
None
))
return
render
(
request
,
'ARFA_app/view_
al
l_question.html'
,
args
)
return
render
(
request
,
'ARFA_app/view_
persona
l_question.html'
,
args
)
def
create_Test
(
request
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
...
...
@@ -470,8 +470,8 @@ def create_Test(request):
res
=
utilities
.
get_all_questions
(
request
)
test
=
None
form
=
forms
.
TestForm
()
args
=
{
'username'
:
request
.
session
[
'username'
],
'questions'
:
res
,
'TestForm'
:
TestForm
,
'is_session'
:
True
}
if
request
.
method
==
"GET"
:
...
...
@@ -511,6 +511,7 @@ def create_Test(request):
# #debug
max_marks
=
0
test
=
None
for
attr
in
dir
(
Test
):
# print attr
...
...
@@ -518,6 +519,29 @@ def create_Test(request):
data
.
pop
(
attr
)
except
KeyError
as
e
:
pass
for
q
in
data
.
keys
():
#compute max_marks ahead
if
len
(
data
[
q
])
!=
3
:
continue
max_marks
+=
int
(
data
[
q
][
1
])
if
form
.
is_valid
():
test
=
form
.
save
(
commit
=
False
)
#not sure, but if a required attribute (like max_marks)
# is not present this may throw an error.
test
.
max_marks
=
max_marks
test
.
save
()
creator
=
models
.
Created_BY
(
test_ID
=
test
,
faculty
=
models
.
Faculty
.
objects
.
filter
(
username
=
request
.
session
[
'username'
])
.
get
())
creator
.
save
()
else
:
if
form
.
errors
:
for
field
in
form
:
print
field
.
errors
return
HttpResponse
(
"Test Form Invalid"
)
containsObj
=
models
.
Contains
(
test_ID
=
test
)
# print data
...
...
@@ -532,7 +556,6 @@ def create_Test(request):
containsObj
.
marks_pos
=
data
[
q
][
1
]
containsObj
.
marks_neg
=
data
[
q
][
2
]
max_marks
+=
int
(
data
[
q
][
1
])
containsObj
.
pk
=
None
containsObj
.
save
()
...
...
@@ -543,20 +566,6 @@ def create_Test(request):
print
e
continue
if
form
.
is_valid
():
test
=
form
.
save
(
commit
=
False
)
#not sure, but if a required attribute (like max_marks)
# is not present this may throw an error.
test
.
max_marks
=
max_marks
test
.
save
()
creator
=
models
.
Created_BY
(
test_ID
=
test
,
faculty
=
models
.
Faculty
.
objects
.
filter
(
username
=
request
.
session
[
'username'
])
.
get
())
creator
.
save
()
else
:
if
form
.
errors
:
for
field
in
form
:
print
field
.
errors
return
HttpResponse
(
"Test Form Invalid"
)
#schedule ranking function when test is finished
print
type
(
test
.
start_time
)
print
type
(
test
.
expected_time_for_completion
)
...
...
@@ -568,6 +577,26 @@ def create_Test(request):
def
same_diffTest
(
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'
)
res
=
utilities
.
get_difficulty
(
request
)
test
=
None
form
=
forms
.
TestForm
()
args
=
{
'username'
:
request
.
session
[
'username'
],
'questions'
:
res
,
'TestForm'
:
TestForm
,
'is_session'
:
True
}
return
render
(
request
,
'ARFA_app/create_Test.html'
,
args
)
def
add_question
(
request
):
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
...
...
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