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
fd7f229a
Commit
fd7f229a
authored
Feb 09, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up profile to output better lists
--HG-- branch : mitx-profilecleanup
parent
ea392495
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
courseware/views.py
+14
-11
No files found.
courseware/views.py
View file @
fd7f229a
...
...
@@ -41,19 +41,19 @@ def profile(request):
return
redirect
(
'/'
)
dom
=
content_parser
.
course_file
(
request
.
user
)
hw
=
[]
course
=
dom
.
xpath
(
'//course/@name'
)[
0
]
c
hapters
=
dom
.
xpath
(
'//course[@name=$course]/chapter'
,
course
=
course
)
xmlC
hapters
=
dom
.
xpath
(
'//course[@name=$course]/chapter'
,
course
=
course
)
responses
=
StudentModule
.
objects
.
filter
(
student
=
request
.
user
)
response_by_id
=
{}
for
response
in
responses
:
response_by_id
[
response
.
module_id
]
=
response
total_scores
=
{}
for
c
in
chapters
:
chapters
=
[]
for
c
in
xmlChapters
:
sections
=
[]
chname
=
c
.
get
(
'name'
)
for
s
in
dom
.
xpath
(
'//course[@name=$course]/chapter[@name=$chname]/section'
,
course
=
course
,
chname
=
chname
):
...
...
@@ -89,9 +89,7 @@ def profile(request):
format_scores
.
append
(
graded_total
)
total_scores
[
format
]
=
format_scores
score
=
{
'course'
:
course
,
'section'
:
s
.
get
(
"name"
),
'chapter'
:
c
.
get
(
"name"
),
score
=
{
'section'
:
s
.
get
(
"name"
),
'scores'
:
scores
,
'section_total'
:
section_total
,
'format'
:
format
,
...
...
@@ -99,7 +97,12 @@ def profile(request):
'due'
:
s
.
get
(
"due"
)
or
""
,
'graded'
:
graded
,
}
hw
.
append
(
score
)
sections
.
append
(
score
)
chapters
.
append
({
'course'
:
course
,
'chapter'
:
c
.
get
(
"name"
),
'sections'
:
sections
,})
def
totalWithDrops
(
scores
,
drop_count
):
#Note that this key will sort the list descending
...
...
@@ -186,7 +189,7 @@ def profile(request):
'location'
:
user_info
.
location
,
'language'
:
user_info
.
language
,
'email'
:
request
.
user
.
email
,
'
homeworks'
:
hw
,
'
chapters'
:
chapters
,
'format_url_params'
:
format_url_params
,
'grade_summary'
:
grade_summary
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
]
...
...
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