diff --git a/modules/tv/src/main/Tv.scala b/modules/tv/src/main/Tv.scala index 3b034a7f9b..c1cab321e4 100644 --- a/modules/tv/src/main/Tv.scala +++ b/modules/tv/src/main/Tv.scala @@ -22,18 +22,19 @@ final class Tv(actor: ActorRef, roundProxyGame: Game.ID => Fu[Option[Game]]) { } flatMap { _ ?? roundProxyGame } def getGameAndHistory(channel: Tv.Channel): Fu[Option[(Game, List[Pov])]] = - (actor ? TvActor.GetGameIdAndHistory(channel) mapTo - manifest[ChannelActor.GameIdAndHistory]) recover { - case e: Exception => - logger.warn("Tv.getGame", e) - none - } flatMap { + (actor ? TvActor.GetGameIdAndHistory(channel) mapTo manifest[ChannelActor.GameIdAndHistory]).map(some) recover { + case e: Exception => + logger.warn("Tv.getGame", e) + none + } flatMap { + _ ?? { case ChannelActor.GameIdAndHistory(gameId, historyIds) => for { game <- gameId ?? roundProxyGame games <- historyIds.map(roundProxyGame).sequenceFu.map(_.flatten) history = games map Pov.first } yield game map (_ -> history) } + } def getGames(channel: Tv.Channel, max: Int): Fu[List[Game]] = (actor ? TvActor.GetGameIds(channel, max) mapTo manifest[List[Game.ID]]) recover { diff --git a/modules/tv/src/main/TvActor.scala b/modules/tv/src/main/TvActor.scala index f79a252ab0..615b684078 100644 --- a/modules/tv/src/main/TvActor.scala +++ b/modules/tv/src/main/TvActor.scala @@ -21,7 +21,7 @@ private[tv] final class TvActor( implicit private def timeout = makeTimeout(100 millis) val channelActors: Map[Tv.Channel, ActorRef] = Tv.Channel.all.map { c => - c -> context.actorOf(Props(classOf[ChannelActor], c), name = c.toString) + c -> context.actorOf(Props(classOf[ChannelActor], c, lightUser), name = c.toString) }.toMap var channelChampions = Map[Tv.Channel, Tv.Champion]()