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
6334d7dd
Commit
6334d7dd
authored
May 08, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up how courses are iterated on instructor dashboard
parent
7bb6d6f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
22 deletions
+15
-22
lms/djangoapps/dashboard/sysadmin.py
+15
-22
No files found.
lms/djangoapps/dashboard/sysadmin.py
View file @
6334d7dd
...
@@ -78,10 +78,7 @@ class SysadminDashboardView(TemplateView):
...
@@ -78,10 +78,7 @@ class SysadminDashboardView(TemplateView):
def
get_courses
(
self
):
def
get_courses
(
self
):
""" Get an iterable list of courses."""
""" Get an iterable list of courses."""
courses
=
self
.
def_ms
.
get_courses
()
return
self
.
def_ms
.
get_courses
()
courses
=
dict
([
c
.
id
.
to_deprecated_string
(),
c
]
for
c
in
courses
)
# no course directory
return
courses
def
return_csv
(
self
,
filename
,
header
,
data
):
def
return_csv
(
self
,
filename
,
header
,
data
):
"""
"""
...
@@ -247,7 +244,6 @@ class Users(SysadminDashboardView):
...
@@ -247,7 +244,6 @@ class Users(SysadminDashboardView):
"""Returns the datatable used for this view"""
"""Returns the datatable used for this view"""
self
.
datatable
=
{}
self
.
datatable
=
{}
courses
=
self
.
get_courses
()
self
.
datatable
=
dict
(
header
=
[
_
(
'Statistic'
),
_
(
'Value'
)],
self
.
datatable
=
dict
(
header
=
[
_
(
'Statistic'
),
_
(
'Value'
)],
title
=
_
(
'Site statistics'
))
title
=
_
(
'Site statistics'
))
...
@@ -257,9 +253,9 @@ class Users(SysadminDashboardView):
...
@@ -257,9 +253,9 @@ class Users(SysadminDashboardView):
self
.
msg
+=
u'<h2>{0}</h2>'
.
format
(
self
.
msg
+=
u'<h2>{0}</h2>'
.
format
(
_
(
'Courses loaded in the modulestore'
))
_
(
'Courses loaded in the modulestore'
))
self
.
msg
+=
u'<ol>'
self
.
msg
+=
u'<ol>'
for
(
cdir
,
course
)
in
courses
.
item
s
():
for
course
in
self
.
get_course
s
():
self
.
msg
+=
u'<li>{0} ({1})</li>'
.
format
(
self
.
msg
+=
u'<li>{0} ({1})</li>'
.
format
(
escape
(
c
dir
),
course
.
location
.
to_deprecated_string
())
escape
(
c
ourse
.
id
.
to_deprecated_string
()
),
course
.
location
.
to_deprecated_string
())
self
.
msg
+=
u'</ol>'
self
.
msg
+=
u'</ol>'
def
get
(
self
,
request
):
def
get
(
self
,
request
):
...
@@ -487,11 +483,10 @@ class Courses(SysadminDashboardView):
...
@@ -487,11 +483,10 @@ class Courses(SysadminDashboardView):
"""Creates course information datatable"""
"""Creates course information datatable"""
data
=
[]
data
=
[]
courses
=
self
.
get_courses
()
for
(
cdir
,
course
)
in
courses
.
item
s
():
for
course
in
self
.
get_course
s
():
gdir
=
c
dir
.
run
gdir
=
c
ourse
.
id
.
run
data
.
append
([
course
.
display_name
,
c
dir
]
data
.
append
([
course
.
display_name
,
c
ourse
.
id
.
to_deprecated_string
()
]
+
self
.
git_info_for_course
(
gdir
))
+
self
.
git_info_for_course
(
gdir
))
return
dict
(
header
=
[
_
(
'Course Name'
),
_
(
'Directory/ID'
),
return
dict
(
header
=
[
_
(
'Course Name'
),
_
(
'Directory/ID'
),
...
@@ -525,7 +520,7 @@ class Courses(SysadminDashboardView):
...
@@ -525,7 +520,7 @@ class Courses(SysadminDashboardView):
track
.
views
.
server_track
(
request
,
action
,
{},
track
.
views
.
server_track
(
request
,
action
,
{},
page
=
'courses_sysdashboard'
)
page
=
'courses_sysdashboard'
)
courses
=
self
.
get_courses
()
courses
=
{
course
.
id
:
course
for
course
in
self
.
get_courses
()}
if
action
==
'add_course'
:
if
action
==
'add_course'
:
gitloc
=
request
.
POST
.
get
(
'repo_location'
,
''
)
.
strip
()
.
replace
(
' '
,
''
)
.
replace
(
';'
,
''
)
gitloc
=
request
.
POST
.
get
(
'repo_location'
,
''
)
.
strip
()
.
replace
(
' '
,
''
)
.
replace
(
';'
,
''
)
branch
=
request
.
POST
.
get
(
'repo_branch'
,
''
)
.
strip
()
.
replace
(
' '
,
''
)
.
replace
(
';'
,
''
)
branch
=
request
.
POST
.
get
(
'repo_branch'
,
''
)
.
strip
()
.
replace
(
' '
,
''
)
.
replace
(
';'
,
''
)
...
@@ -544,10 +539,12 @@ class Courses(SysadminDashboardView):
...
@@ -544,10 +539,12 @@ class Courses(SysadminDashboardView):
course
=
get_course_by_id
(
course_key
)
course
=
get_course_by_id
(
course_key
)
course_found
=
True
course_found
=
True
except
Exception
,
err
:
# pylint: disable=broad-except
except
Exception
,
err
:
# pylint: disable=broad-except
self
.
msg
+=
_
(
'Error - cannot get course with ID '
self
.
msg
+=
_
(
'{0}<br/><pre>{1}</pre>'
)
.
format
(
'Error - cannot get course with ID {0}<br/><pre>{1}</pre>'
course_id
,
escape
(
str
(
err
))
)
.
format
(
)
course_key
,
escape
(
str
(
err
))
)
is_xml_course
=
(
modulestore
()
.
get_modulestore_type
(
course_key
)
==
XML_MODULESTORE_TYPE
)
is_xml_course
=
(
modulestore
()
.
get_modulestore_type
(
course_key
)
==
XML_MODULESTORE_TYPE
)
if
course_found
and
is_xml_course
:
if
course_found
and
is_xml_course
:
...
@@ -599,9 +596,7 @@ class Staffing(SysadminDashboardView):
...
@@ -599,9 +596,7 @@ class Staffing(SysadminDashboardView):
raise
Http404
raise
Http404
data
=
[]
data
=
[]
courses
=
self
.
get_courses
()
for
course
in
self
.
get_courses
():
# pylint: disable=unused-variable
for
(
cdir
,
course
)
in
courses
.
items
():
# pylint: disable=unused-variable
datum
=
[
course
.
display_name
,
course
.
id
]
datum
=
[
course
.
display_name
,
course
.
id
]
datum
+=
[
CourseEnrollment
.
objects
.
filter
(
datum
+=
[
CourseEnrollment
.
objects
.
filter
(
course_id
=
course
.
id
)
.
count
()]
course_id
=
course
.
id
)
.
count
()]
...
@@ -635,9 +630,7 @@ class Staffing(SysadminDashboardView):
...
@@ -635,9 +630,7 @@ class Staffing(SysadminDashboardView):
data
=
[]
data
=
[]
roles
=
[
CourseInstructorRole
,
CourseStaffRole
,
]
roles
=
[
CourseInstructorRole
,
CourseStaffRole
,
]
courses
=
self
.
get_courses
()
for
course
in
self
.
get_courses
():
# pylint: disable=unused-variable
for
(
cdir
,
course
)
in
courses
.
items
():
# pylint: disable=unused-variable
for
role
in
roles
:
for
role
in
roles
:
for
user
in
role
(
course
.
id
)
.
users_with_role
():
for
user
in
role
(
course
.
id
)
.
users_with_role
():
datum
=
[
course
.
id
,
role
,
user
.
username
,
user
.
email
,
datum
=
[
course
.
id
,
role
,
user
.
username
,
user
.
email
,
...
...
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