Minor fix in BillEntry
[aquarium] / src / main / scala / gr / grnet / aquarium / charging / bill / BillEntry.scala
index f93562f..dfe2110 100644 (file)
@@ -243,7 +243,7 @@ object AbstractBillEntry {
     val map1 = map0.foldLeft(TreeMap[String,List[ResourceEntry]]()){ case (map,(_,r1)) =>
       map.get(r1.resourceType) match {
         case None =>  map + ((r1.resourceType,List(r1)))
-        case Some(rl) => (map - r1.resourceType) +  ((r1.resourceName,r1::rl))
+        case Some(rl) => (map - r1.resourceType) +  ((r1.resourceType,r1::rl))
       }
     }
     map1.foldLeft(List[ServiceEntry]()){ case (ret,(serviceName,resList)) =>
@@ -271,12 +271,13 @@ object AbstractBillEntry {
     //Console.err.println("After rounding timeslot: " + t)
     val ret = w match {
       case None =>
+          val allMissing = addMissingServices(Nil,resourceTypes)
           new BillEntry(counter.getAndIncrement.toString,
                         userID,"processing",
                         "0.0",
                         "0.0",
                         t.from.getTime.toString,t.to.getTime.toString,
-                        Nil)
+                        allMissing)
       case Some(w) =>
         val wjson = AvroHelpers.jsonStringOfSpecificRecord(w)
         Console.err.println("Working user state: %s".format(wjson))