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
1f16e090
Commit
1f16e090
authored
Nov 26, 2018
by
NARRA SURAJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disabled load test for attempted tests
parent
ee12e8d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
9 deletions
+31
-9
ARFA/ARFA/settings.py
ARFA/ARFA/settings.py
+1
-1
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
+19
-4
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+10
-3
No files found.
ARFA/ARFA/settings.py
View file @
1f16e090
...
...
@@ -88,7 +88,7 @@ DATABASES = {
'USERNAME'
:
'arfa_username'
,
'USER'
:
'arfa_username'
,
'PASSWORD'
:
''
,
'HOST'
:
'1
27.0.0.1
'
,
'HOST'
:
'1
0.42.0.172
'
,
'PORT'
:
'5430'
}
}
...
...
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
View file @
1f16e090
...
...
@@ -13,7 +13,7 @@ Total Time :<b > {{total_time.hours}} {{total_time.minutes}} </b>
<p>
Max Marks.
<b>
{{max_marks}}
</b>
</p>
<div
id=
"Timer"
style=
"border-style: solid; text-align: center;"
></div>
</div>
<h2
align=
"center"
style=
" text-decoration: underline;"
><b>
{{testName.test_name}}
</b>
</h2>
<h2
align=
"center"
style=
" text-decoration: underline;"
><b>
{{testName.test_name}}
</b>
</h2>
</div>
<script>
function
submitExam
()
...
...
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
View file @
1f16e090
...
...
@@ -17,16 +17,25 @@ My Tests
<ul
class=
"list-group"
>
{% for t in activeTests %}
<div
class=
"row"
style=
"margin-bottom: 10px; margin-top: 5px"
>
<div
style=
"float: left; margin-left: 20px"
>
<p><i>
Test Id
</i>
<b>
{{t.test_ID}}
</b></p>
<p><i>
Test Name
</i>
<b>
{{t.test_name}}
</b>
</p>
</div>
</div>
<div
style=
"float:right"
>
<form
method=
"POST"
action=
"loadStudentTest"
>
{% 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>
{% if t.hasTaken is True %}
<button
type=
"button"
disabled
class=
"btn btn-login float-right"
style=
"margin-top: 10px ;margin-right: 40px"
>
Attempted
</button>
{% else %}
<button
type=
"submit"
class=
"btn btn-login float-right"
style=
"margin-top: 10px ;margin-right: 40px"
>
Load Test
</button>
{% endif %}
</form>
</div>
</div>
{% endfor %}
</ul>
</div>
...
...
@@ -50,12 +59,18 @@ My Tests
<form
method=
"POST"
action=
"loadStudentTest"
>
{% 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>
<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 %}
{% 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>
<button
type=
"submit"
class=
"btn btn-login float-right"
style=
"margin-top: 10px ;margin-right: 40px"
>
View Results
</button>
{% endif %}
</form>
</div>
</div>
...
...
ARFA/ARFA_app/views.py
View file @
1f16e090
...
...
@@ -235,6 +235,7 @@ def studentTestHome(request):
return
render
(
request
,
'ARFA_app/login.html'
)
if
(
request
.
session
.
get
(
'role'
,
None
)
!=
"student"
):
return
HttpResponse
(
"Not a student"
)
username
=
request
.
session
[
'username'
]
now
=
datetime
.
datetime
.
now
()
print
now
...
...
@@ -242,12 +243,16 @@ def studentTestHome(request):
start_time__lte
=
now
)
practiceTests
=
Test
.
objects
.
filter
(
start_time__lte
=
now
-
F
(
'expected_time_for_completion'
))
data
=
{}
data
[
'username'
]
=
request
.
session
[
'username'
]
data
[
'username'
]
=
username
data
[
'is_session'
]
=
True
data
[
'activeTests'
]
=
[]
#data['activeTests'] is a list of dicts. Each dict contains info about a test
for
t
in
activeTests
:
hasTaken
=
models
.
Takes
.
objects
.
filter
(
test_ID_id
=
t
.
test_ID
,
student_id
=
username
)
.
exists
()
print
"hastaken
\n\n\n\n\n\n
"
print
hasTaken
data
[
'activeTests'
]
.
append
({
'test_ID'
:
t
.
test_ID
,
'test_name'
:
t
.
test_name
,
'marks'
:
t
.
max_marks
,
'start_time'
:
t
.
start_time
})
'marks'
:
t
.
max_marks
,
'start_time'
:
t
.
start_time
,
'hasTaken'
:
hasTaken
})
data
[
'practiceTests'
]
=
[]
for
t
in
practiceTests
:
...
...
@@ -255,8 +260,10 @@ def studentTestHome(request):
# print t.test_ID
# print datetime.datetime.now() - t.start_time - t.expected_time_for_completion
# debug
hasTaken
=
models
.
Takes
.
objects
.
filter
(
test_ID_id
=
t
.
test_ID
,
student_id
=
username
)
.
exists
()
data
[
'practiceTests'
]
.
append
({
'test_ID'
:
t
.
test_ID
,
'test_name'
:
t
.
test_name
,
'marks'
:
t
.
max_marks
,
'start_time'
:
t
.
start_time
})
'marks'
:
t
.
max_marks
,
'start_time'
:
t
.
start_time
,
'hasTaken'
:
hasTaken
})
print
data
return
render
(
request
,
'ARFA_app/studentTestHome.html'
,
data
)
...
...
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