hasValidStreak method

bool hasValidStreak()

Implementation

bool hasValidStreak() {
  if (hasSessions() && _sessions.length > 1) {
    for (int i = _sessions.length - 1; i > 1; i--) {
      int j = i - 1;
      DateKey top = _sessions.elementAt(i).dateKey();
      DateKey bottom = _sessions.elementAt(j).dateKey();
      // test for same date which is ok
      if (top == bottom) {
        continue;
      } else if (bottom.isDayBefore(top)) {
        return true;
      } else {
        return false;
      }
    }
  }
  return false;
}