|
|
@ -28,6 +28,9 @@ import org.isoron.uhabits.core.models.*;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class CreateRepetitionCommand extends Command
|
|
|
|
public class CreateRepetitionCommand extends Command
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
|
|
|
final HabitList list;
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
final Habit habit;
|
|
|
|
final Habit habit;
|
|
|
|
|
|
|
|
|
|
|
@ -41,10 +44,12 @@ public class CreateRepetitionCommand extends Command
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
Repetition newRep;
|
|
|
|
Repetition newRep;
|
|
|
|
|
|
|
|
|
|
|
|
public CreateRepetitionCommand(@NonNull Habit habit,
|
|
|
|
public CreateRepetitionCommand(@NonNull HabitList list,
|
|
|
|
|
|
|
|
@NonNull Habit habit,
|
|
|
|
Timestamp timestamp,
|
|
|
|
Timestamp timestamp,
|
|
|
|
int value)
|
|
|
|
int value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
this.list = list;
|
|
|
|
this.timestamp = timestamp;
|
|
|
|
this.timestamp = timestamp;
|
|
|
|
this.habit = habit;
|
|
|
|
this.habit = habit;
|
|
|
|
this.value = value;
|
|
|
|
this.value = value;
|
|
|
@ -65,6 +70,7 @@ public class CreateRepetitionCommand extends Command
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
habit.invalidateNewerThan(timestamp);
|
|
|
|
habit.invalidateNewerThan(timestamp);
|
|
|
|
|
|
|
|
list.update(habit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
@ -88,6 +94,7 @@ public class CreateRepetitionCommand extends Command
|
|
|
|
|
|
|
|
|
|
|
|
if (previousRep != null) habit.getRepetitions().add(previousRep);
|
|
|
|
if (previousRep != null) habit.getRepetitions().add(previousRep);
|
|
|
|
habit.invalidateNewerThan(timestamp);
|
|
|
|
habit.invalidateNewerThan(timestamp);
|
|
|
|
|
|
|
|
list.update(habit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class Record
|
|
|
|
public static class Record
|
|
|
@ -122,7 +129,7 @@ public class CreateRepetitionCommand extends Command
|
|
|
|
|
|
|
|
|
|
|
|
CreateRepetitionCommand command;
|
|
|
|
CreateRepetitionCommand command;
|
|
|
|
command = new CreateRepetitionCommand(
|
|
|
|
command = new CreateRepetitionCommand(
|
|
|
|
h, new Timestamp(repTimestamp), value);
|
|
|
|
habitList, h, new Timestamp(repTimestamp), value);
|
|
|
|
command.setId(id);
|
|
|
|
command.setId(id);
|
|
|
|
return command;
|
|
|
|
return command;
|
|
|
|
}
|
|
|
|
}
|
|
|
|