Reuse user creation time from user state
authorChristos KK Loverdos <loverdos@gmail.com>
Fri, 16 Mar 2012 13:04:07 +0000 (15:04 +0200)
committerChristos KK Loverdos <loverdos@gmail.com>
Fri, 16 Mar 2012 13:04:07 +0000 (15:04 +0200)
src/main/scala/gr/grnet/aquarium/user/UserStateComputations.scala
src/test/scala/gr/grnet/aquarium/user/UserStateComputationsTest.scala

index dbed853..c76ae85 100644 (file)
@@ -81,7 +81,6 @@ class UserStateComputations extends Loggable {
   def findUserStateAtEndOfBillingMonth(userId: String,
                                        billingMonthInfo: BillingMonthInfo,
                                        storeProvider: StoreProvider,
-                                       userCreationMillis: Long,
                                        currentUserState: UserState,
                                        zeroUserState: UserState, 
                                        defaultResourcesMap: DSLResourcesMap,
@@ -100,7 +99,6 @@ class UserStateComputations extends Loggable {
         userId,
         billingMonthInfo,
         storeProvider,
-        userCreationMillis,
         currentUserState,
         zeroUserState,
         defaultResourcesMap,
@@ -112,6 +110,7 @@ class UserStateComputations extends Loggable {
     val userStateStore = storeProvider.userStateStore
     val resourceEventStore = storeProvider.resourceEventStore
 
+    val userCreationMillis = currentUserState.userCreationMillis
     val userCreationDateCalc = new MutableDateCalc(userCreationMillis)
     val billingMonthStartMillis = billingMonthInfo.startMillis
     val billingMonthStopMillis  = billingMonthInfo.stopMillis
@@ -195,7 +194,6 @@ class UserStateComputations extends Loggable {
   def doFullMonthlyBilling(userId: String,
                            billingMonthInfo: BillingMonthInfo,
                            storeProvider: StoreProvider,
-                           userCreationMillis: Long,
                            currentUserState: UserState,
                            zeroUserState: UserState,
                            defaultResourcesMap: DSLResourcesMap,
@@ -219,7 +217,6 @@ class UserStateComputations extends Loggable {
       userId,
       billingMonthInfo.previousMonth,
       storeProvider,
-      userCreationMillis,
       currentUserState,
       zeroUserState,
       defaultResourcesMap,
index a5faaa0..27f0d56 100644 (file)
@@ -185,7 +185,6 @@ aquariumpolicy:
       UserCKKL.userId,
       billingMonthInfo,
       storeProvider,
-      UserCKKL.userCreationDate.getTime,
       currentUserState,
       initialUserState,
       DefaultResourcesMap,