diff options
Diffstat (limited to 'src/main/scala/reading/models/Level.scala')
-rw-r--r-- | src/main/scala/reading/models/Level.scala | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/main/scala/reading/models/Level.scala b/src/main/scala/reading/models/Level.scala index 1f7e153..329c720 100644 --- a/src/main/scala/reading/models/Level.scala +++ b/src/main/scala/reading/models/Level.scala @@ -5,14 +5,8 @@ import enumeratum._ sealed trait Level extends EnumEntry with Ordered[Level] { import Level._ - def compare(that: Level) = { - def toInt(level: Level): Int = level match { - case Sixieme => 6 - case Cinquieme => 5 - case Quatrieme => 4 - case Troisieme => 3 - } - toInt(that) - toInt(this) + def compare(that: Level): Int = { + values.indexOf(that) - values.indexOf(this) } override def toString(): String = this match { |