Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
a84884ff
Unverified
Commit
a84884ff
authored
6 years ago
by
Awais Jibran
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #18157 from edx/aj/fix-courseware-title-error
Fix Courseware IndexError
parents
2d4dd375
f4883e1b
No related branches found
Branches containing commit
Tags
release-2021-06-30-06.16
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/courseware/views/index.py
+17
-16
17 additions, 16 deletions
lms/djangoapps/courseware/views/index.py
with
17 additions
and
16 deletions
lms/djangoapps/courseware/views/index.py
+
17
−
16
View file @
a84884ff
...
...
@@ -437,24 +437,25 @@ class CoursewareIndex(View):
)
courseware_context
[
'
fragment
'
]
=
self
.
section
.
render
(
STUDENT_VIEW
,
section_context
)
if
self
.
section
.
position
and
self
.
section
.
has_children
:
display_items
=
self
.
section
.
get_display_items
()
if
display_items
:
try
:
courseware_context
[
'
sequence_title
'
]
=
display_items
[
self
.
section
.
position
-
1
]
\
.
display_name_with_default
except
IndexError
:
log
.
exception
(
"
IndexError loading courseware for user %s, course %s, section %s, position %d. Total items: %d. URL: %s
"
,
self
.
real_user
.
username
,
self
.
course
.
id
,
self
.
section
.
display_name_with_default
,
self
.
section
.
position
,
len
(
display_items
),
self
.
url
,
)
raise
self
.
_add_sequence_title_to_context
(
courseware_context
)
return
courseware_context
def
_add_sequence_title_to_context
(
self
,
courseware_context
):
"""
Adds sequence title to the given context.
If we
'
re rendering a section with some display items, but position
exceeds the length of the displayable items, default the position
to the first element.
"""
display_items
=
self
.
section
.
get_display_items
()
if
not
display_items
:
return
if
self
.
section
.
position
>
len
(
display_items
):
self
.
section
.
position
=
1
courseware_context
[
'
sequence_title
'
]
=
display_items
[
self
.
section
.
position
-
1
].
display_name_with_default
def
_add_entrance_exam_to_context
(
self
,
courseware_context
):
"""
Adds entrance exam related information to the given 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