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
0c5395a5
Commit
0c5395a5
authored
Jul 18, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #200 from MITx/dormsbee/unknown_courses
Ignore registrations for Courses that can't be found
parents
72f772d6
7acfdcd1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
common/djangoapps/student/views.py
+11
-1
No files found.
common/djangoapps/student/views.py
View file @
0c5395a5
...
...
@@ -29,6 +29,7 @@ from student.models import Registration, UserProfile, PendingNameChange, Pending
from
util.cache
import
cache_if_anonymous
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
log
=
logging
.
getLogger
(
"mitx.student"
)
...
...
@@ -80,7 +81,16 @@ def dashboard(request):
course_loc
=
CourseDescriptor
.
id_to_location
(
id
)
return
modulestore
()
.
get_item
(
course_loc
)
courses
=
[
course_from_id
(
enrollment
.
course_id
)
for
enrollment
in
enrollments
]
# Build our courses list for the user, but ignore any courses that no longer
# exist (because the course IDs have changed). Still, we don't delete those
# enrollments, because it could have been a data push snafu.
courses
=
[]
for
enrollment
in
enrollments
:
try
:
courses
.
append
(
course_from_id
(
enrollment
.
course_id
))
except
ItemNotFoundError
:
log
.
error
(
"User {0} enrolled in non-existant course {1}"
.
format
(
user
.
username
,
enrollment
.
course_id
))
context
=
{
'csrf'
:
csrf_token
,
'courses'
:
courses
}
return
render_to_response
(
'dashboard.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