A few changes so that everything compiles
authorChristos KK Loverdos <loverdos@gmail.com>
Tue, 31 Jan 2012 14:25:37 +0000 (16:25 +0200)
committerChristos KK Loverdos <loverdos@gmail.com>
Tue, 31 Jan 2012 14:26:25 +0000 (16:26 +0200)
src/main/scala/gr/grnet/aquarium/user/UserStateComputations.scala
src/main/scala/gr/grnet/aquarium/user/actor/UserActor.scala

index cfd1d70..e29ec1e 100644 (file)
@@ -91,7 +91,7 @@ class UserStateComputations {
       0L,
       ActiveSuspendedSnapshot(false, now),
       CreditSnapshot(0, now),
-      AgreementSnapshot(agreementName, now),
+      AgreementSnapshot(Agreement(agreementName, now, now) :: Nil, now),
       RolesSnapshot(List(), now),
       PaymentOrdersSnapshot(Nil, now),
       OwnedGroupsSnapshot(Nil, now),
@@ -113,20 +113,20 @@ class UserStateComputations {
     val billingDate = new DateCalculator(billingYear, billingMonth, 1)
     val billingDateMillis = billingDate.toMillis
 
-    if(billingDateMillis < knownUserState.startDateMillis) {
-      val userId = knownUserState.userId
-      val agreementName = knownUserState.agreement match {
-        case null      ⇒ "default"
-        case agreement ⇒ agreement.data
-      }
-      createFirstUserState(userId, agreementName)
-    } else {
+//    if(billingDateMillis < knownUserState.startDateMillis) {
+//      val userId = knownUserState.userId
+//      val agreementName = knownUserState.agreement match {
+//        case null      ⇒ "default"
+//        case agreement ⇒ agreement.data
+//      }
+//      createFirstUserState(userId, agreementName)
+//    } else {
       // We really need to compute the user state here
 
       // get all events that
       // FIXME: Implement
       knownUserState
-    }
+//    }
   }
 
 
index 3dc1f42..e24e8fe 100644 (file)
@@ -258,7 +258,7 @@ class UserActor extends AquariumActor
     val walletEntries = resourceEvents.map {
       ev =>
         // TODO: Check that agreement exists
-        val agreement = policy.findAgreement(_userState.agreement.data).get
+        val agreement = policy.findAgreement(_userState.agreements.data.head.agreement).get
 
         val resource = policy.findResource(ev.resource) match {
           case Some(x) => x