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
0d699f28
Commit
0d699f28
authored
Feb 03, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added links from profile to courseware. Updated names in urls to accomodate.
parent
de585e2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
courseware/views.py
+9
-5
urls.py
+7
-7
No files found.
courseware/views.py
View file @
0d699f28
...
...
@@ -95,8 +95,10 @@ def profile(request):
def
totalWithDrops
(
scores
,
drop_count
):
sorted_scores
=
sorted
(
enumerate
(
scores
),
key
=
lambda
x
:
-
x
[
1
][
'percentage'
]
)
#Note that this key will sort the list descending
dropped_indices
=
[
score
[
0
]
for
score
in
sorted_scores
[
-
drop_count
:]]
# A list of the indices of the dropped scores
#Note that this key will sort the list descending
sorted_scores
=
sorted
(
enumerate
(
scores
),
key
=
lambda
x
:
-
x
[
1
][
'percentage'
]
)
# A list of the indices of the dropped scores
dropped_indices
=
[
score
[
0
]
for
score
in
sorted_scores
[
-
drop_count
:]]
aggregate_score
=
0
for
index
,
score
in
enumerate
(
scores
):
if
index
not
in
dropped_indices
:
...
...
@@ -176,16 +178,18 @@ def profile(request):
'language'
:
user_info
.
language
,
'email'
:
request
.
user
.
email
,
'homeworks'
:
hw
,
'format_url_params'
:
format_url_params
,
'grade_summary'
:
grade_summary
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
]
}
return
render_to_response
(
'profile.html'
,
context
)
def
format_url_params
(
params
):
return
[
urllib
.
quote
(
string
.
replace
(
' '
,
'_'
))
for
string
in
params
]
def
render_accordion
(
request
,
course
,
chapter
,
section
):
''' Draws navigation bar. Takes current position in accordion as
parameter. Returns (initialization_javascript, content)'''
def
format_string
(
string
):
return
urllib
.
quote
(
string
.
replace
(
' '
,
'_'
))
toc
=
content_parser
.
toc_from_xml
(
content_parser
.
course_file
(
request
.
user
),
chapter
,
section
)
active_chapter
=
1
...
...
@@ -195,7 +199,7 @@ def render_accordion(request,course,chapter,section):
context
=
dict
([[
'active_chapter'
,
active_chapter
],
[
'toc'
,
toc
],
[
'course_name'
,
course
],
[
'format_
string'
,
format_string
],
[
'format_
url_params'
,
format_url_params
],
[
'csrf'
,
csrf
(
request
)[
'csrf_token'
]]]
+
\
template_imports
.
items
())
return
{
'init_js'
:
render_to_string
(
'accordion_init.js'
,
context
),
...
...
urls.py
View file @
0d699f28
...
...
@@ -35,11 +35,11 @@ if settings.PERFSTATS:
urlpatterns
=
urlpatterns
+
(
url
(
r'^reprofile$'
,
'perfstats.views.end_profile'
),)
if
settings
.
COURSEWARE_ENABLED
:
urlpatterns
=
urlpatterns
+
(
url
(
r'^courseware/$'
,
'courseware.views.index'
),
url
(
r'^wiki/'
,
include
(
'simplewiki.urls'
)),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$'
,
'courseware.views.index'
),
url
(
r'^courseware/(?P<course>[^/]*)/$'
,
'courseware.views.index'
),
urlpatterns
=
urlpatterns
+
(
url
(
r'^courseware/$'
,
'courseware.views.index'
,
name
=
"courseware"
),
url
(
r'^wiki/'
,
include
(
'simplewiki.urls'
)),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$'
,
'courseware.views.index'
,
name
=
"courseware_section"
),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$'
,
'courseware.views.index'
,
name
=
"courseware_chapter"
),
url
(
r'^courseware/(?P<course>[^/]*)/$'
,
'courseware.views.index'
,
name
=
"courseware_course"
),
url
(
r'^modx/(?P<module>[^/]*)/(?P<id>[^/]*)/(?P<dispatch>[^/]*)$'
,
'courseware.views.modx_dispatch'
),
#reset_problem'),
url
(
r'^profile$'
,
'courseware.views.profile'
),
url
(
r'^change_setting$'
,
'student.views.change_setting'
),
...
...
@@ -47,8 +47,8 @@ url(r'^wiki/', include('simplewiki.urls')),
url
(
r'^book/(?P<page>[^/]*)$'
,
'staticbook.views.index'
),
url
(
r'^book-shifted/(?P<page>[^/]*)$'
,
'staticbook.views.index_shifted'
),
url
(
r'^book*$'
,
'staticbook.views.index'
),
# url(r'^course_info/$', 'student.views.courseinfo'),
# url(r'^show_circuit/(?P<circuit>[^/]*)$', 'circuit.views.show_circuit'),
# url(r'^course_info/$', 'student.views.courseinfo'),
# url(r'^show_circuit/(?P<circuit>[^/]*)$', 'circuit.views.show_circuit'),
url
(
r'^edit_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.edit_circuit'
),
url
(
r'^save_circuit/(?P<circuit>[^/]*)$'
,
'circuit.views.save_circuit'
),
url
(
r'^calculate$'
,
'util.views.calculate'
),
...
...
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