Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
7bea9382
Commit
7bea9382
authored
Feb 19, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling case of response not in cache explicitly
--HG-- branch : profile-cache
parent
88adbc95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
courseware/views.py
+15
-17
No files found.
courseware/views.py
View file @
7bea9382
...
...
@@ -38,30 +38,28 @@ def get_grade(request, problem, cache):
## HACK: assumes max score is fixed per problem
id
=
problem
.
get
(
'id'
)
correct
=
0
print
","
,
if
id
in
cache
:
print
"In cache"
response
=
cache
[
id
]
if
response
.
grade
!=
None
:
correct
=
response
.
grade
if
id
in
cache
and
response
.
max_grade
!=
None
:
total
=
response
.
max_grade
el
se
:
#
if id in cache and response.max_grade == None:
elif
id
in
cache
and
response
.
max_grade
==
None
:
total
=
courseware
.
modules
.
capa_module
.
Module
(
etree
.
tostring
(
problem
),
"id"
)
.
max_score
()
#
response.max_grade = total
#
response.save()
#
else: # if id not in cache
#
total=courseware.modules.capa_module.Module(etree.tostring(problem), "id").max_score()
#
module = StudentModule(module_type = 'problem',
#
module_id = id,
#
student = request.user,
#
state = None,
#
grade = 0,
#
max_grade = total,
#
done = 'i')
#
total=courseware.modules.capa_module.Module(etree.tostring(problem), "id").max_score()
#
module.save()
#
cache[id] = module
response
.
max_grade
=
total
response
.
save
()
else
:
# if id not in cache
total
=
courseware
.
modules
.
capa_module
.
Module
(
etree
.
tostring
(
problem
),
"id"
)
.
max_score
()
module
=
StudentModule
(
module_type
=
'problem'
,
module_id
=
id
,
student
=
request
.
user
,
state
=
None
,
grade
=
0
,
max_grade
=
total
,
done
=
'i'
)
total
=
courseware
.
modules
.
capa_module
.
Module
(
etree
.
tostring
(
problem
),
"id"
)
.
max_score
()
module
.
save
()
cache
[
id
]
=
module
return
(
correct
,
total
)
...
...
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