fix empty result of rating history API endpoint

This commit is contained in:
Thibault Duplessis 2020-04-12 19:08:17 -06:00
parent 08004bbb8b
commit bea1b52788

View file

@ -171,7 +171,10 @@ final class User(
def ratingHistory(username: String) = OpenBody { implicit ctx =>
EnabledUser(username) { u =>
env.history.ratingChartApi(u) map { Ok(_) as JSON }
env.history
.ratingChartApi(u)
.dmap(_ | "[]") // send an empty JSON array if no history JSON is available
.dmap { Ok(_) as JSON }
}
}