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
9ba59fe3
Commit
9ba59fe3
authored
Jan 30, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on adding up graded scores for sections.
--HG-- branch : profiledev
parent
c6d2ea6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
courseware/module_render.py
+1
-0
courseware/views.py
+20
-4
No files found.
courseware/module_render.py
View file @
9ba59fe3
import
StringIO
import
json
import
logging
import
os
import
sys
import
sys
...
...
courseware/views.py
View file @
9ba59fe3
...
...
@@ -46,7 +46,8 @@ def profile(request):
for
response
in
responses
:
response_by_id
[
response
.
module_id
]
=
response
print
response_by_id
totalScores
=
{}
for
c
in
chapters
:
chname
=
c
.
get
(
'name'
)
...
...
@@ -63,19 +64,34 @@ def profile(request):
response
=
response_by_id
[
id
]
if
response
.
grade
!=
None
:
correct
=
response
.
grade
else
:
print
"Couldn't find id "
+
id
total
=
courseware
.
modules
.
capa_module
.
LoncapaModule
(
etree
.
tostring
(
p
),
"id"
)
.
max_score
()
# TODO: Add state. Not useful now, but maybe someday problems will have randomized max scores?
scores
.
append
((
int
(
correct
),
total
))
scores
.
append
((
int
(
correct
),
total
,
(
True
if
s
.
get
(
'graded'
)
==
"True"
else
False
)
))
section_total
=
(
sum
([
score
[
0
]
for
score
in
scores
]),
sum
([
score
[
1
]
for
score
in
scores
]))
graded_total
=
(
sum
([
score
[
0
]
for
score
in
scores
if
score
[
2
]]),
sum
([
score
[
1
]
for
score
in
scores
if
score
[
2
]]))
#Add the graded total to totalScores
if
s
.
get
(
'format'
)
and
graded_total
[
1
]
>
0
:
format_scores
=
totalScores
[
s
.
get
(
'format'
)
]
if
s
.
get
(
'format'
)
in
totalScores
else
[]
format_scores
.
append
(
graded_total
)
totalScores
[
s
.
get
(
'format'
)
]
=
format_scores
score
=
{
'course'
:
course
,
'section'
:
s
.
get
(
"name"
),
'chapter'
:
c
.
get
(
"name"
),
'scores'
:
scores
,
'section_total'
:
section_total
,
}
hw
.
append
(
score
)
user_info
=
UserProfile
.
objects
.
get
(
user
=
request
.
user
)
print
"totalScores"
,
totalScores
context
=
{
'name'
:
user_info
.
name
,
'username'
:
request
.
user
.
username
,
...
...
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