feat: sort problems by whether its solved first, then color and lastly lexicographically.

This commit is contained in:
Alexander Klee 2024-05-31 20:42:40 +02:00 committed by JFronny
parent bdd107e7c5
commit 9eddbf96bf
Signed by: Johannes
GPG Key ID: E76429612C2929F4

View File

@ -10,8 +10,8 @@ data class SDProblem(val id: String, val name: String, val rgb: Color, var solve
}
override fun compareTo(other: SDProblem): Int {
if (solved && !other.solved) return 1
if (!solved && other.solved) return -1
return name.compareTo(other.name)
return solved.compareTo(other.solved)
.run { if (this == 0) rgb.rgb.compareTo(other.rgb.rgb) else this }
.run { if (this == 0) name.compareTo(other.name) else this }
}
}