feat: sort problems by whether its solved first, then color and lastly lexicographically.
This commit is contained in:
parent
bdd107e7c5
commit
9eddbf96bf
@ -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 }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user