Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
0c5395a5
Commit
0c5395a5
authored
12 years ago
by
David Ormsbee
Browse files
Options
Downloads
Plain Diff
Merge pull request #200 from MITx/dormsbee/unknown_courses
Ignore registrations for Courses that can't be found
parents
72f772d6
7acfdcd1
No related branches found
Branches containing commit
Tags
release-2020-11-02-12.26
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/djangoapps/student/views.py
+11
-1
11 additions, 1 deletion
common/djangoapps/student/views.py
with
11 additions
and
1 deletion
common/djangoapps/student/views.py
+
11
−
1
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment