adding question to habit and habit record

This commit is contained in:
Rechee
2020-01-06 12:36:25 -08:00
parent 997ebfc28a
commit 88b9645be1
2 changed files with 24 additions and 2 deletions

View File

@@ -354,14 +354,26 @@ public class Habit
data.position = newPosition;
}
@NonNull
public String getQuestion() {
return data.question;
}
public void setQuestion(@NonNull String question) {
data.question = question;
}
public static final class HabitData
{
@NonNull
public String name;
@NonNull
@Nullable
public String description;
@NonNull
public String question;
@NonNull
public Frequency frequency;
@@ -390,7 +402,8 @@ public class Habit
this.frequency = new Frequency(3, 7);
this.type = YES_NO_HABIT;
this.name = "";
this.description = "";
this.description = null;
this.question = "";
this.targetType = AT_LEAST;
this.targetValue = 100;
this.unit = "";
@@ -401,6 +414,7 @@ public class Habit
{
this.name = model.name;
this.description = model.description;
this.question = model.question;
this.frequency = model.frequency;
this.color = model.color;
this.archived = model.archived;
@@ -427,6 +441,7 @@ public class Habit
.append("unit", unit)
.append("reminder", reminder)
.append("position", position)
.append("question", question)
.toString();
}
@@ -451,6 +466,7 @@ public class Habit
.append(unit, habitData.unit)
.append(reminder, habitData.reminder)
.append(position, habitData.position)
.append(question, habitData.question)
.isEquals();
}
@@ -469,6 +485,7 @@ public class Habit
.append(unit)
.append(reminder)
.append(position)
.append(question)
.toHashCode();
}
}

View File

@@ -33,6 +33,9 @@ public class HabitRecord
@Column
public String description;
@Column
public String question;
@Column
public String name;
@@ -91,6 +94,7 @@ public class HabitRecord
this.targetValue = model.getTargetValue();
this.unit = model.getUnit();
this.position = model.getPosition();
this.question = model.getQuestion();
Frequency freq = model.getFrequency();
this.freqNum = freq.getNumerator();
@@ -113,6 +117,7 @@ public class HabitRecord
habit.setId(this.id);
habit.setName(this.name);
habit.setDescription(this.description);
habit.setQuestion(this.question);
habit.setFrequency(new Frequency(this.freqNum, this.freqDen));
habit.setColor(this.color);
habit.setArchived(this.archived != 0);