compute tournament trophies from secondary dbs
This commit is contained in:
parent
6d25894e5b
commit
7be3ef6547
|
@ -2,6 +2,7 @@ package lila.tournament
|
|||
|
||||
import org.joda.time.DateTime
|
||||
import scala.concurrent.duration._
|
||||
import reactivemongo.api.ReadPreference
|
||||
|
||||
import chess.variant.Variant
|
||||
import lila.db.dsl._
|
||||
|
@ -27,7 +28,7 @@ final class RevolutionApi(
|
|||
"startsAt" $lt DateTime.now $gt DateTime.now.minusYears(1).minusDays(1),
|
||||
"name" -> $doc("$regex" -> """ Revolution #\d+$"""),
|
||||
"status" -> statusBSONHandler.write(Status.Finished)
|
||||
), $doc("winner" -> true, "variant" -> true)).list[Bdoc]() map { docOpt =>
|
||||
), $doc("winner" -> true, "variant" -> true)).list[Bdoc](none, ReadPreference.secondaryPreferred) map { docOpt =>
|
||||
val awards = for {
|
||||
doc <- docOpt
|
||||
winner <- doc.getAs[User.ID]("winner")
|
||||
|
|
|
@ -2,6 +2,7 @@ package lila.tournament
|
|||
|
||||
import org.joda.time.DateTime
|
||||
import scala.concurrent.duration._
|
||||
import reactivemongo.api.ReadPreference
|
||||
|
||||
import lila.db.dsl._
|
||||
import lila.rating.PerfType
|
||||
|
@ -35,7 +36,7 @@ final class TournamentShieldApi(
|
|||
f = coll.find($doc(
|
||||
"schedule.freq" -> scheduleFreqHandler.write(Schedule.Freq.Shield),
|
||||
"status" -> statusBSONHandler.write(Status.Finished)
|
||||
)).sort($sort asc "startsAt").list[Tournament]() map { tours =>
|
||||
)).sort($sort asc "startsAt").list[Tournament](none, ReadPreference.secondaryPreferred) map { tours =>
|
||||
for {
|
||||
tour <- tours
|
||||
categ <- Category of tour
|
||||
|
|
Loading…
Reference in a new issue