@teleivo, we discussed
in today’s Design Forum (notes here). Here’s the outcome of that discussion:
Background (feel free to skip if you like)
In the transition to Platform 2.0, the
isFuture method, which was considering the order’s activation date, was removed and we mistakenly switched from using it to using
isStarted inside the
isFuture was a confusing name for a method determining whether or not an order has been activated. An “activated” order represents a request that may have been sent to a receiving system. Currently, all orders stored in the API are considered activated (their
dateActivated defaults to now). In future version of the Platform, this may change. For example, we may allow for draft & pending orders or orders needing cosignature that could be stored via the API before being activated.
isFuture was removed, the
isActive method mistakenly replaced it with checking
isStarted. Any activated orders (currently, all orders written to the API) should be considered active unless they have been discontinued or have expired. The
isStarted method checks the start date for scheduled orders and does not apply to an order’s active status. To clarify, “active” does not mean that the order is being actively carried out; rather, it means that the order has been activated and has not yet been countermanded or run its course (expired). This means scheduled orders written to start in the future are still considered “active” before their start date, since these “active” order can be discontinued or revised prior to the start date. Thus,
isStarted has no bearing on whether or not an order is active.
Any activated order is active unless it has expired or been discontinued. This means future orders (orders scheduled to start in the future) should return
isActive == true. For example, the last line will look something like:
return isActivated(checkDate) && !isDiscontinued(checkDate) && !isExpired(checkDate);
2. The logic for the new public method
isActivated(checkDate) should be:
Returns true for an order that has been activated (not in a draft or pending state). Currently, all orders stored in the API are considered activated (draft or pending orders are not yet implemented).
return dateActivated != null &&
(dateActivated.before(checkDate) || dateActivated.equals(checkDate));
(note that the new public method
isActivated will effectively be the inverse of the previous
isFuture method, which was functioning as a poorly named