Skip to content

Commit

Permalink
fix: Attempts not showing in attempt list for Quiz exams (#568)
Browse files Browse the repository at this point in the history
- Previously while ending the quiz exam we only ended the user exam
attempt, not the chapter content attempt.
- In this commit, we end the chapter content attempt when the exam ends.
  • Loading branch information
PruthiviRaj27 committed Sep 5, 2023
1 parent 5b597fe commit d9a0b41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ data class DomainContentAttempt(
val assessment: DomainAttempt? = null
)

fun DomainContentAttempt.getEndAttemptUrl(context: Context):String? {
return this.getGreenDaoContentAttempt(context)?.endAttemptUrl
}

fun createDomainContentAttempt(contentAttempt: CourseAttempt): DomainContentAttempt {
return DomainContentAttempt(
id = contentAttempt.id,
Expand Down
3 changes: 2 additions & 1 deletion course/src/main/java/in/testpress/course/ui/QuizActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package `in`.testpress.course.ui
import `in`.testpress.core.TestpressException
import `in`.testpress.core.TestpressSdk
import `in`.testpress.course.R
import `in`.testpress.course.domain.getEndAttemptUrl
import `in`.testpress.enums.Status
import `in`.testpress.course.fragments.ExamEndHanlder
import `in`.testpress.course.fragments.LoadingQuestionsFragment
Expand Down Expand Up @@ -142,7 +143,7 @@ class QuizActivity : BaseToolBarActivity(), ShowQuizHandler, ExamEndHanlder, Que
viewModel.loadAttempt(attemptId).observe(this, Observer {
contentAttemptId = it?.data!!.id
this.attemptId = it.data!!.assessment?.id!!
examEndUrl = it?.data?.assessment?.endUrl
examEndUrl = it?.data?.getEndAttemptUrl(this)
val examId = intent.getLongExtra("EXAM_ID", -1)
val bundle = Bundle().apply {
putLong("EXAM_ID", examId)
Expand Down

0 comments on commit d9a0b41

Please sign in to comment.