Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myLife: smoother search mySubmission survey (fixes #5238) #5350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -14,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import io.realm.Case
import io.realm.Realm
import io.realm.RealmQuery
import io.realm.Sort
import org.ole.planet.myplanet.base.BaseRecyclerFragment.Companion.showNoData
import org.ole.planet.myplanet.databinding.FragmentMySubmissionBinding
import org.ole.planet.myplanet.datamanager.DatabaseService
Expand All @@ -23,6 +25,7 @@ import org.ole.planet.myplanet.model.RealmSubmission
import org.ole.planet.myplanet.model.RealmSubmission.Companion.getExamMap
import org.ole.planet.myplanet.model.RealmUserModel
import org.ole.planet.myplanet.service.UserProfileDbHandler
import java.util.Locale

class MySubmissionFragment : Fragment(), CompoundButton.OnCheckedChangeListener {
private lateinit var fragmentMySubmissionBinding: FragmentMySubmissionBinding
Expand Down Expand Up @@ -99,9 +102,19 @@ class MySubmissionFragment : Fragment(), CompoundButton.OnCheckedChangeListener
.contains("name", s, Case.INSENSITIVE).findAll()
q?.`in`("parentId", getIds(ex))
}
/*
if (q != null) {
submissions = q.findAll().mapNotNull { it as? RealmSubmission }
}
*/
//test
if (q != null) {
submissions = (q.findAll()).mapNotNull { it as? RealmSubmission }
//.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.user ?: "" })
//.filter { it.id?.startsWith(s, ignoreCase = true) == true }
.sortedBy { it.id?.lowercase(Locale.ROOT) ?: "" }
}
//test done

val adapter = AdapterMySubmission(requireActivity(), submissions, exams)
val itemCount = adapter.itemCount
Expand Down
Loading