Skip to content

Commit

Permalink
[Teacher][RC-1.11.1] Fix crash in QuizDetailsFragment when the quiz i…
Browse files Browse the repository at this point in the history
…sn't an assignment (#1000)
  • Loading branch information
JordanMarshall authored Sep 17, 2020
1 parent fcd79e5 commit 0f68d38
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,17 @@ class QuizDetailsFragment : BasePresenterFragment<
}

submissionsLayout.setOnClickListener {
navigateToSubmissions(mCourse, quiz._assignment!!, SubmissionListFilter.ALL)
navigateToSubmissions(mCourse, quiz._assignment, SubmissionListFilter.ALL)
}
viewAllSubmissions.onClick { submissionsLayout.performClick() } // Separate click listener for a11y
gradedWrapper.setOnClickListener {
navigateToSubmissions(mCourse, quiz._assignment!!, SubmissionListFilter.GRADED)
navigateToSubmissions(mCourse, quiz._assignment, SubmissionListFilter.GRADED)
}
ungradedWrapper.setOnClickListener {
navigateToSubmissions(mCourse, quiz._assignment!!, SubmissionListFilter.NOT_GRADED)
navigateToSubmissions(mCourse, quiz._assignment, SubmissionListFilter.NOT_GRADED)
}
notSubmittedWrapper.setOnClickListener {
navigateToSubmissions(mCourse, quiz._assignment!!, SubmissionListFilter.MISSING)
navigateToSubmissions(mCourse, quiz._assignment, SubmissionListFilter.MISSING)
}
noInstructionsTextView.setOnClickListener {
openEditPage(quiz)
Expand All @@ -415,7 +415,8 @@ class QuizDetailsFragment : BasePresenterFragment<
}
}

private fun navigateToSubmissions(course: Course, assignment: Assignment, filter: SubmissionListFilter) {
private fun navigateToSubmissions(course: Course, assignment: Assignment?, filter: SubmissionListFilter) {
assignment ?: return // We can't navigate to the submission list if there isn't an associated assignment
val args = AssignmentSubmissionListFragment.makeBundle(assignment, filter)
RouteMatcher.route(requireContext(), Route(null, AssignmentSubmissionListFragment::class.java, course, args))
}
Expand Down

0 comments on commit 0f68d38

Please sign in to comment.