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
b546ab5e
Commit
b546ab5e
authored
Nov 25, 2018
by
NARRA SURAJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved evaluation
parent
808a20df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
ARFA/ARFA_app/utilities.py
ARFA/ARFA_app/utilities.py
+20
-3
No files found.
ARFA/ARFA_app/utilities.py
View file @
b546ab5e
...
...
@@ -9,6 +9,7 @@ from .models import Question
from
.models
import
Options
from
.models
import
Student
from
.models
import
Evaluation
from
.models
import
Takes
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
HttpResponse
...
...
@@ -16,6 +17,7 @@ from django.views.decorators.cache import cache_control
import
json
from
django.db
import
connection
from
django.db
import
IntegrityError
import
datetime
def
evaluate
(
responses
,
otherData
):
#create evaluation object
...
...
@@ -27,14 +29,17 @@ def evaluate(responses, otherData):
# attempt.student = Student.objects.get(username=request.session['username'])
# attemptObj.test = responses[0].test_ID
# attemptObj.save()
evalObj
.
student_id
=
otherData
[
'username'
]
evalObj
.
test_ID_id
=
int
(
otherData
[
'testID'
])
# evalObj.attempt = attemptObj
evalObj
.
q_ID
=
None
totalMarks
=
0
correctAnswer
=
None
for
response
in
responses
:
evalObj
=
Evaluation
()
evalObj
.
student_id
=
otherData
[
'username'
]
evalObj
.
test_ID_id
=
int
(
otherData
[
'testID'
])
evalObj
.
q_ID
=
None
(
question
,
options
),
=
response
.
items
()
question
=
int
(
question
)
# options = responses[question]
...
...
@@ -57,6 +62,7 @@ def evaluate(responses, otherData):
print
correctAnswer
if
len
(
responseList
)
==
len
(
correctAnswer
)
and
sorted
(
responseList
)
==
sorted
(
correctAnswer
):
evalObj
.
marks
=
1
totalMarks
=
totalMarks
+
evalObj
.
marks
# print "responses"
# print responseList
# print correctAnswer
...
...
@@ -67,6 +73,17 @@ def evaluate(responses, otherData):
print
"Integrity error - evaluation not recorded"
pass
takesObj
=
Takes
()
takesObj
.
student_id
=
otherData
[
'username'
]
takesObj
.
test_ID_id
=
otherData
[
'testID'
]
takesObj
.
time_stamp
=
datetime
.
datetime
.
now
()
takesObj
.
total_marks
=
totalMarks
try
:
takesObj
.
save
()
except
IntegrityError
as
e
:
print
"Integrity error in Takes - not recorded"
pass
def
getOptions
(
question
):
#returns queryset
return
models
.
Options
.
objects
.
get
(
q_ID
=
question
)
...
...
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