streakCount method
Implementation
int streakCount() {
int streakCount = 0;
if (hasSessions()) {
if (_sessions.length == 1 && _sessions.elementAt(0).dateKey().isToday()) {
return 1;
} else if (_sessions.length > 1) {
DateKey current = _sessions.elementAt(_sessions.length - 1).dateKey();
streakCount++;
for (int i = _sessions.length - 2; i >= 0; i--) {
DateKey comparable = _sessions.elementAt(i).dateKey();
// test for same date which is ok
if (current == comparable) {
continue;
} else if (comparable.isDayBefore(current)) {
streakCount++;
current = comparable;
continue;
} else {
break;
}
}
}
}
return streakCount;
}