Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small refactor

  • Loading branch information...
commit dfb3937a00f06dc11b8a71890dd9fb726e6628fc 1 parent 5c7ac0b
@Dinduks authored
Showing with 6 additions and 6 deletions.
  1. +5 −5 app/actors/HungryUserActor.scala
  2. +1 −1  public/javascripts/main.js
View
10 app/actors/HungryUserActor.scala
@@ -23,10 +23,10 @@ object HungryUsersHandler {
val result = (mainActor ? Connect(id, name)).map {
case enumerator: Enumerator[JsValue] => {
val iteratee = Iteratee.foreach[JsValue] { event =>
- val userId = (event \ "data" \ "userId").as[String]
- val restaurantName = (event \ "data" \ "restaurantName").as[String]
(event \ "kind").as[String] match {
case "joinrestaurant" => {
+ val userId = (event \ "data" \ "userId").as[String]
+ val restaurantName = (event \ "data" \ "restaurantName").as[String]
mainActor ! JoinRestaurant(userId, restaurantName)
}
}
@@ -46,7 +46,7 @@ object HungryUsersHandler {
class HungryUserActor extends Actor {
val hungryUsers: HungryUsersIndex = mutable.Map.empty
- val (outEnumerator, chatChannel) = Concurrent.broadcast[JsValue]
+ val (outEnumerator, outChannel) = Concurrent.broadcast[JsValue]
def receive = {
case Connect(id, name) => {
@@ -67,11 +67,11 @@ class HungryUserActor extends Actor {
def updateAll {
val msg = JsObject(Seq("users" -> Json.toJson(hungryUsers)))
- chatChannel.push(msg)
+ outChannel.push(msg)
}
}
case class Connect(id: String, name: String)
case class JoinRestaurant(userId: String, restaurantName: String)
-case class UpdateAll
+case class UpdateAll()
View
2  public/javascripts/main.js
@@ -73,4 +73,4 @@ function Restaurant(name) {
this.users = [];
this.push = function (user) { this.users.push(user); };
-}
+}

0 comments on commit dfb3937

Please sign in to comment.
Something went wrong with that request. Please try again.