|
|
@ -55,7 +55,7 @@ public abstract class CheckmarkList
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (reps.length == 0) throw new IllegalArgumentException();
|
|
|
|
if (reps.length == 0) throw new IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
|
|
Timestamp today = DateUtils.getToday();
|
|
|
|
Timestamp today = DateUtils.getTodayWithOffset();
|
|
|
|
Timestamp begin = reps[0].getTimestamp();
|
|
|
|
Timestamp begin = reps[0].getTimestamp();
|
|
|
|
if (intervals.size() > 0) begin = Timestamp.oldest(begin, intervals.get(0).begin);
|
|
|
|
if (intervals.size() > 0) begin = Timestamp.oldest(begin, intervals.get(0).begin);
|
|
|
|
|
|
|
|
|
|
|
@ -181,7 +181,7 @@ public abstract class CheckmarkList
|
|
|
|
if (oldestRep == null) return new int[0];
|
|
|
|
if (oldestRep == null) return new int[0];
|
|
|
|
|
|
|
|
|
|
|
|
Timestamp fromTimestamp = oldestRep.getTimestamp();
|
|
|
|
Timestamp fromTimestamp = oldestRep.getTimestamp();
|
|
|
|
Timestamp toTimestamp = DateUtils.getToday();
|
|
|
|
Timestamp toTimestamp = DateUtils.getTodayWithOffset();
|
|
|
|
|
|
|
|
|
|
|
|
return getValues(fromTimestamp, toTimestamp);
|
|
|
|
return getValues(fromTimestamp, toTimestamp);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -211,7 +211,7 @@ public abstract class CheckmarkList
|
|
|
|
public synchronized final Checkmark getToday()
|
|
|
|
public synchronized final Checkmark getToday()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
compute();
|
|
|
|
compute();
|
|
|
|
Timestamp today = DateUtils.getToday();
|
|
|
|
Timestamp today = DateUtils.getTodayWithOffset();
|
|
|
|
return getByInterval(today, today).get(0);
|
|
|
|
return getByInterval(today, today).get(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -325,7 +325,7 @@ public abstract class CheckmarkList
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected final synchronized void compute()
|
|
|
|
protected final synchronized void compute()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
final Timestamp today = DateUtils.getToday();
|
|
|
|
final Timestamp today = DateUtils.getTodayWithOffset();
|
|
|
|
|
|
|
|
|
|
|
|
Checkmark newest = getNewestComputed();
|
|
|
|
Checkmark newest = getNewestComputed();
|
|
|
|
if (newest != null && newest.getTimestamp().equals(today)) return;
|
|
|
|
if (newest != null && newest.getTimestamp().equals(today)) return;
|
|
|
@ -335,6 +335,8 @@ public abstract class CheckmarkList
|
|
|
|
if (oldestRep == null) return;
|
|
|
|
if (oldestRep == null) return;
|
|
|
|
final Timestamp from = oldestRep.getTimestamp();
|
|
|
|
final Timestamp from = oldestRep.getTimestamp();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (from.isNewerThan(today)) return;
|
|
|
|
|
|
|
|
|
|
|
|
Repetition reps[] = habit
|
|
|
|
Repetition reps[] = habit
|
|
|
|
.getRepetitions()
|
|
|
|
.getRepetitions()
|
|
|
|
.getByInterval(from, today)
|
|
|
|
.getByInterval(from, today)
|
|
|
@ -364,7 +366,7 @@ public abstract class CheckmarkList
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (reps.length == 0) return;
|
|
|
|
if (reps.length == 0) return;
|
|
|
|
|
|
|
|
|
|
|
|
Timestamp today = DateUtils.getToday();
|
|
|
|
Timestamp today = DateUtils.getTodayWithOffset();
|
|
|
|
Timestamp begin = reps[0].getTimestamp();
|
|
|
|
Timestamp begin = reps[0].getTimestamp();
|
|
|
|
|
|
|
|
|
|
|
|
int nDays = begin.daysUntil(today) + 1;
|
|
|
|
int nDays = begin.daysUntil(today) + 1;
|
|
|
@ -392,7 +394,7 @@ public abstract class CheckmarkList
|
|
|
|
public List<Checkmark> getAll() {
|
|
|
|
public List<Checkmark> getAll() {
|
|
|
|
Repetition oldest = habit.getRepetitions().getOldest();
|
|
|
|
Repetition oldest = habit.getRepetitions().getOldest();
|
|
|
|
if(oldest == null) return new ArrayList<>();
|
|
|
|
if(oldest == null) return new ArrayList<>();
|
|
|
|
return getByInterval(oldest.getTimestamp(), DateUtils.getToday());
|
|
|
|
return getByInterval(oldest.getTimestamp(), DateUtils.getTodayWithOffset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static final class Interval
|
|
|
|
static final class Interval
|
|
|
|