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