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
8712197d
Commit
8712197d
authored
Feb 01, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple graphing of homework and lab scores
--HG-- branch : profiledev
parent
6f2f08fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
courseware/views.py
+33
-7
No files found.
courseware/views.py
View file @
8712197d
...
...
@@ -76,29 +76,55 @@ def profile(request):
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
=
s
.
get
(
'format'
)
if
s
.
get
(
'format'
)
else
""
if
format
and
graded_total
[
1
]
>
0
:
format_scores
=
totalScores
[
format
]
if
format
in
totalScores
else
[]
format_scores
.
append
(
graded_total
)
totalScores
[
s
.
get
(
'format'
)
]
=
format_scores
totalScores
[
format
]
=
format_scores
score
=
{
'course'
:
course
,
'section'
:
s
.
get
(
"name"
),
'chapter'
:
c
.
get
(
"name"
),
'scores'
:
scores
,
'section_total'
:
section_total
,
'format'
:
format
,
}
hw
.
append
(
score
)
user_info
=
UserProfile
.
objects
.
get
(
user
=
request
.
user
)
print
"totalScores"
,
totalScores
#Figure the homework scores
print
totalScores
homeworkScores
=
totalScores
[
'Homework'
]
if
'Homework'
in
totalScores
else
[]
homeworkPercentages
=
[]
for
i
in
range
(
12
):
if
i
<
len
(
homeworkScores
):
percentage
=
homeworkScores
[
i
][
0
]
/
float
(
homeworkScores
[
i
][
1
])
else
:
percentage
=
0
homeworkPercentages
.
append
(
percentage
)
labScores
=
totalScores
[
'Lab'
]
if
'Lab'
in
totalScores
else
[]
labPercentages
=
[]
for
i
in
range
(
12
):
if
i
<
len
(
labScores
):
percentage
=
labScores
[
i
][
0
]
/
float
(
labScores
[
i
][
1
])
else
:
percentage
=
0
labPercentages
.
append
(
percentage
)
user_info
=
UserProfile
.
objects
.
get
(
user
=
request
.
user
)
context
=
{
'name'
:
user_info
.
name
,
'username'
:
request
.
user
.
username
,
'location'
:
user_info
.
location
,
'language'
:
user_info
.
language
,
'email'
:
request
.
user
.
email
,
'homeworks'
:
hw
,
'homeworks'
:
hw
,
'homework_percentages'
:
homeworkPercentages
,
'lab_percentages'
:
labPercentages
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
]
}
return
render_to_response
(
'profile.html'
,
context
)
...
...
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