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
5ca0fc72
Commit
5ca0fc72
authored
Nov 27, 2018
by
SANCHIT JAIN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove prints
parent
82070acd
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2617 additions
and
70 deletions
+2617
-70
ARFA/ARFA/settings.py
ARFA/ARFA/settings.py
+1
-1
ARFA/ARFA_app/migrations/0001_initial.py
ARFA/ARFA_app/migrations/0001_initial.py
+1
-1
ARFA/ARFA_app/templates/ARFA_app/performance.html
ARFA/ARFA_app/templates/ARFA_app/performance.html
+15
-6
ARFA/ARFA_app/templates/ARFA_app/student_performance.html
ARFA/ARFA_app/templates/ARFA_app/student_performance.html
+13
-5
ARFA/ARFA_app/utilities.py
ARFA/ARFA_app/utilities.py
+5
-11
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+4
-46
ARFA/with_prvate_public_q.sql
ARFA/with_prvate_public_q.sql
+2578
-0
No files found.
ARFA/ARFA/settings.py
View file @
5ca0fc72
...
...
@@ -88,7 +88,7 @@ DATABASES = {
'USERNAME'
:
'arfa_username'
,
'USER'
:
'arfa_username'
,
'PASSWORD'
:
''
,
'HOST'
:
'1
27.0.0.1
'
,
'HOST'
:
'1
0.42.0.43
'
,
'PORT'
:
'5430'
}
}
...
...
ARFA/ARFA_app/migrations/0001_initial.py
View file @
5ca0fc72
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1
6 on 2018-11-27 03:40
# Generated by Django 1.11.1
5 on 2018-11-27 04:14
from
__future__
import
unicode_literals
import
django.core.validators
...
...
ARFA/ARFA_app/templates/ARFA_app/performance.html
View file @
5ca0fc72
...
...
@@ -29,7 +29,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
{%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"
>
<
!-- <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"
>
...
...
@@ -97,15 +97,24 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<h3
class=
"panel-title"
>
Per Question stats
</h3>
</div>
<ul
class=
"list-group"
>
{%for q in question_stats%}
{%for q
uestion
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>
{{question.question_text}}
</br>
<p
style=
"float:right;"
><b>
Difficulty:
</b>
{{question.difficulty_set}}
</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>
...
...
@@ -114,7 +123,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%for option in q
uestion
.option_details%}
{%if option.is_answer %}
<li>
<p
style=
"color: green"
>
{{option.option_text}}
</p>
...
...
ARFA/ARFA_app/templates/ARFA_app/student_performance.html
View file @
5ca0fc72
...
...
@@ -120,15 +120,23 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<h3
class=
"panel-title"
>
Per Question stats
</h3>
</div>
<ul
class=
"list-group"
>
{%for q in question_stats%}
{%for q
uestion
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>
{{question.question_text}}
</br>
<p
style=
"float:right;"
><b>
Difficulty:
</b>
{{question.difficulty_set}}
</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>
...
...
@@ -137,7 +145,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%for option in q
uestion
.option_details%}
{%if option.is_answer %}
<li>
<p
style=
"color: green"
>
{{option.option_text}}
</p>
...
...
ARFA/ARFA_app/utilities.py
View file @
5ca0fc72
...
...
@@ -31,16 +31,11 @@ def evaluate(responses, otherData):
if
len
(
responses
)
==
0
:
return
#debugging:
print
"responses:"
print
responses
#marks for each question:
#list of question ids
print
"QList"
QList
=
[
int
(
question
)
for
[(
question
,
_
)]
in
[
response
.
items
()
for
response
in
responses
]]
print
QList
#select contains objects for which test_ID=tetsID, q_ID belongs to list QList
contains
=
models
.
Contains
.
objects
.
filter
(
test_ID
=
otherData
[
'testID'
],
q_ID__in
=
QList
)
...
...
@@ -71,7 +66,6 @@ def evaluate(responses, otherData):
# evalObj.marks = 1
responseList
=
options
print
correctAnswer
if
len
(
responseList
)
==
len
(
correctAnswer
)
and
sorted
(
responseList
)
==
sorted
(
correctAnswer
):
evalObj
.
marks
=
marksDict
[
question
][
0
]
#0 - first in the list, marks_pos
...
...
@@ -208,7 +202,6 @@ def result_analysis(request,test_ID):
def
get_questions_dict
(
cursor
):
rows
=
cursor
.
fetchall
()
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res
=
[]
options_so_far
=
[]
...
...
@@ -237,9 +230,10 @@ def get_questions_dict(cursor):
def
get_responses_side_by_side
(
test
,
student
):
cursor
=
connection
.
cursor
()
cursor
.
execute
(
''' SELECT q."q_ID" as q_ID,q.question_text,
cursor
.
execute
(
''' SELECT q."q_ID" as q_ID,q.question_text,
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 @
5ca0fc72
...
...
@@ -242,7 +242,6 @@ def studentTestHome(request):
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
()
data
[
'activeTests'
]
.
append
({
'test_ID'
:
t
.
test_ID
,
'test_name'
:
t
.
test_name
,
...
...
@@ -441,34 +440,7 @@ def create_Test(request):
data
.
pop
(
'csrfmiddlewaretoken'
)
if
not
data
:
#only csrf token was sent, display create test page
return
render
(
request
,
'ARFA_app/create_Test.html'
,
args
)
print
data
form
=
forms
.
TestForm
(
request
.
POST
)
#A failed attempt to make html datetimeinput work.
#refer to this when you want to try again.
# """dirty workaround"""
# #the data in request.POST must be modified to be valid in the form
# data['start_time'] = data['start_time'][0].replace('T', ' ') #remove the 'T' in HTML returned string
# data['expected_time_for_completion'] = data['expected_time_for_completion'][0]+":00"
# #add seconds to duration string
# data['max_marks'] = int(data['max_marks'][0]) #convert max_marks from string to int
# #if these are not in these exact formats everything may break.
# #see form cleanup for a potentially better solution
# qdict = QueryDict("", mutable=True)
# qdict.update(data)
# form2 = forms.TestForm(request.POST)
# print "form2:"
# print vars(form2)
# print "\n\n\n"
# #debug
# print "start time"
# print form
# print vars(form)
# #debug
max_marks
=
0
test
=
None
...
...
@@ -519,18 +491,13 @@ def create_Test(request):
containsObj
.
pk
=
None
containsObj
.
save
()
print
"success"
print
containsObj
except
ValueError
as
e
:
data
.
pop
(
q
)
print
e
continue
#schedule ranking function when test is finished
print
type
(
test
.
start_time
)
print
type
(
test
.
expected_time_for_completion
)
tasks
.
testRanks
(
test
.
test_ID
,
schedule
=
(
test
.
start_time
+
test
.
expected_time_for_completion
))
print
test
.
start_time
+
test
.
expected_time_for_completion
print
"testRanks being called
\n\n\n\n
"
return
view_personal_Test
(
request
)
...
...
@@ -566,7 +533,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'
]
==
''
:
print
'failed'
return
HttpResponse
(
json
.
dumps
({
'status'
:
'Failed'
,
'reason'
:
'No question provided'
}))
...
...
@@ -608,7 +574,6 @@ def view_personal_Test(request):
WHERE c."test_ID_id" = t."test_ID" and c.faculty_id =
%
s
order by t.start_time desc '''
,[
request
.
session
[
'username'
]])
rows
=
cursor
.
fetchall
()
print
rows
columns
=
[
col
[
0
]
for
col
in
cursor
.
description
]
res
=
[]
for
val
in
rows
:
...
...
@@ -630,7 +595,6 @@ def view_all_Test(request):
WHERE 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
:
...
...
@@ -645,23 +609,17 @@ def analyse_test(request):
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
)
...
...
@@ -681,7 +639,7 @@ def student_results(request):
test_ID
=
request
.
POST
[
"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
()
start_time__lte
=
-
datetime
.
timedelta
(
minutes
=
5
)
+
datetime
.
datetime
.
now
()
-
F
(
'expected_time_for_completion'
))
.
all
()
if
len
(
test
)
==
0
:
...
...
@@ -727,7 +685,7 @@ def student_responses(request):
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
()
start_time__lte
=
-
datetime
.
timedelta
(
minutes
=
5
)
+
datetime
.
datetime
.
now
()
-
F
(
'expected_time_for_completion'
))
.
all
()
if
len
(
test
)
==
0
:
...
...
ARFA/with_prvate_public_q.sql
0 → 100644
View file @
5ca0fc72
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