Skip to content

Commit

Permalink
resolve realm submission error
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 committed Jan 3, 2025
1 parent 2fe24fb commit 73b7899
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/src/main/java/org/ole/planet/myplanet/model/RealmSubmission.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,18 @@ class RealmSubmission : RealmObject {
}
}

@JvmStatic
fun generateParentId(courseId: String?, examId: String?): String? {
return if (!examId.isNullOrEmpty()) {
if (!courseId.isNullOrEmpty()) {
"$examId@$courseId"
} else {
examId
}
} else {
null
}
}

fun getNoOfSubmissionByUser(id: String?, courseId: String?, userId: String?, mRealm: Realm): String {
if (id == null || userId == null) return "No Submissions Found"
val submissionParentId = generateParentId(courseId, id)
Expand All @@ -214,7 +225,6 @@ class RealmSubmission : RealmObject {
return MainApplication.context.getString(R.string.survey_taken) + " " + submissionCount + " " + pluralizedString
}

@JvmStatic
fun getNoOfSurveySubmissionByUser(userId: String?, mRealm: Realm): Int {
if (userId == null) return 0
return mRealm.query<RealmSubmission>(
Expand Down

0 comments on commit 73b7899

Please sign in to comment.