/**
* Finds all relevant resource events for the billing period.
* The relevant events are those:
- * a) whose `occurredMillis` is within the given billing period and
+ * a) whose `occurredMillis` is within the given billing period or
* b) whose `receivedMillis` is within the given billing period.
*
* Order them by `occurredMillis`
*/
def findAllRelevantResourceEventsForBillingPeriod(userId: String,
startMillis: Long,
- stopMillis: Long): List[ResourceEvent] =
- findResourceEventsForReceivedPeriod(userId, startMillis, stopMillis)
+ stopMillis: Long): List[ResourceEvent]
}
\ No newline at end of file
stopTimeMillis: Long): List[ResourceEvent] = {
resourceEventsById.valuesIterator.filter { ev ⇒
ev.userId == userId &&
- ev.receivedMillis >= startTimeMillis &&
- ev.receivedMillis <= stopTimeMillis
+ ev.isReceivedWithinMillis(startTimeMillis, stopTimeMillis)
}.toList
}