Skip to content

Commit

Permalink
replacing getDescription with getQuestion all over the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rechee committed Jan 8, 2020
1 parent 0ec604f commit fb98c5f
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@ private void resetState() throws Exception

Habit h1 = fixtures.createEmptyHabit();
h1.setName("Wake up early");
h1.setDescription("Did you wake up early today?");
h1.setQuestion("Did you wake up early today?");
h1.setColor(5);
habitList.update(h1);

Habit h2 = fixtures.createShortHabit();
h2.setName("Track time");
h2.setDescription("Did you track your time?");
h2.setQuestion("Did you track your time?");
h2.setColor(5);
habitList.update(h2);

Habit h3 = fixtures.createLongHabit();
h3.setName("Meditate");
h3.setDescription("Did meditate today?");
h3.setQuestion("Did meditate today?");
h3.setColor(10);
habitList.update(h3);

Habit h4 = fixtures.createEmptyHabit();
h4.setName("Read books");
h4.setDescription("Did you read books today?");
h4.setQuestion("Did you read books today?");
h4.setColor(2);
habitList.update(h4);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Habit createEmptyHabit(Long id)
{
Habit habit = modelFactory.buildHabit();
habit.setName("Meditate");
habit.setDescription("Did you meditate this morning?");
habit.setQuestion("Did you meditate this morning?");
habit.setColor(5);
habit.setFrequency(Frequency.DAILY);
habit.setId(id);
Expand Down Expand Up @@ -81,7 +81,7 @@ public Habit createLongNumericalHabit()
{
Habit habit = modelFactory.buildHabit();
habit.setName("Take a walk");
habit.setDescription("How many steps did you walk today?");
habit.setQuestion("How many steps did you walk today?");
habit.setType(Habit.NUMBER_HABIT);
habit.setTargetType(Habit.AT_LEAST);
habit.setTargetValue(200.0);
Expand All @@ -103,7 +103,7 @@ public Habit createShortHabit()
{
Habit habit = modelFactory.buildHabit();
habit.setName("Wake up early");
habit.setDescription("Did you wake up before 6am?");
habit.setQuestion("Did you wake up before 6am?");
habit.setFrequency(new Frequency(2, 3));
habitList.add(habit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected void refreshData()

if (habit.hasReminder()) updateReminderText(habit.getReminder());

if (habit.getDescription().isEmpty()) questionLabel.setVisibility(GONE);
if (habit.getQuestion().isEmpty()) questionLabel.setVisibility(GONE);

invalidate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class AndroidNotificationTray
val builder = NotificationCompat.Builder(context, REMINDERS_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(habit.name)
.setContentText(if(habit.description.isNullOrBlank()) defaultText else habit.description)
.setContentText(if(habit.question.isBlank()) defaultText else habit.question)
.setContentIntent(pendingIntents.showHabit(habit))
.setDeleteIntent(pendingIntents.dismissNotification(habit))
.addAction(addRepetitionAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void importHabitsFromFile(@NonNull final File file)
String name = line[0];
if (name.equals("HabitName")) continue;

String description = line[1];
String question = line[1];
String dateString[] = line[3].split("-");
int year = Integer.parseInt(dateString[0]);
int month = Integer.parseInt(dateString[1]);
Expand All @@ -87,7 +87,7 @@ public void importHabitsFromFile(@NonNull final File file)
{
h = modelFactory.buildHabit();
h.setName(name);
h.setDescription(description);
h.setQuestion(question);
h.setFrequency(Frequency.DAILY);
habitList.add(h);
map.put(name, h);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void createHabits(Database db)
{
int id = c.getInt(0);
String name = c.getString(1);
String description = c.getString(2);
String question = c.getString(2);
int schedule = c.getInt(3);
String activeDays = c.getString(4);
int repeatingCount = c.getInt(5);
Expand All @@ -101,7 +101,7 @@ private void createHabits(Database db)

Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setDescription(description);
habit.setQuestion(question);

int periods[] = { 7, 31, 365 };
int numerator, denominator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ private void createHabits(Database db)
{
int id = c.getInt(0);
String name = c.getString(1);
String description = c.getString(2);
String question = c.getString(2);

Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setDescription(description);
habit.setQuestion(question);
habit.setFrequency(Frequency.DAILY);
habitList.add(habit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void writeCSV(@NonNull Writer out) throws IOException
String[] cols = {
String.format("%03d", indexOf(habit) + 1),
habit.getName(),
habit.getDescription(),
habit.getQuestion(),
Integer.toString(freq.getNumerator()),
Integer.toString(freq.getDenominator()),
ColorConstants.CSV_PALETTE[habit.getColor()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Habit createEmptyHabit()
{
Habit habit = modelFactory.buildHabit();
habit.setName("Meditate");
habit.setDescription("Did you meditate this morning?");
habit.setQuestion("Did you meditate this morning?");
habit.setColor(3);
habit.setFrequency(Frequency.DAILY);
saveIfSQLite(habit);
Expand Down Expand Up @@ -73,7 +73,7 @@ public Habit createNumericalHabit()
Habit habit = modelFactory.buildHabit();
habit.setType(Habit.NUMBER_HABIT);
habit.setName("Run");
habit.setDescription("How many miles did you run today?");
habit.setQuestion("How many miles did you run today?");
habit.setUnit("miles");
habit.setTargetType(Habit.AT_LEAST);
habit.setTargetValue(2.0);
Expand All @@ -98,7 +98,7 @@ public Habit createLongNumericalHabit(Timestamp reference)
Habit habit = modelFactory.buildHabit();
habit.setType(Habit.NUMBER_HABIT);
habit.setName("Walk");
habit.setDescription("How many steps did you walk today?");
habit.setQuestion("How many steps did you walk today?");
habit.setUnit("steps");
habit.setTargetType(Habit.AT_LEAST);
habit.setTargetValue(100);
Expand Down Expand Up @@ -133,7 +133,7 @@ public Habit createShortHabit()
{
Habit habit = modelFactory.buildHabit();
habit.setName("Wake up early");
habit.setDescription("Did you wake up before 6am?");
habit.setQuestion("Did you wake up before 6am?");
habit.setFrequency(new Frequency(2, 3));
saveIfSQLite(habit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testHabitBullCSV() throws IOException

Habit habit = habitList.getByPosition(0);
assertThat(habit.getName(), equalTo("Breed dragons"));
assertThat(habit.getDescription(), equalTo("with love and fire"));
assertThat(habit.getQuestion(), equalTo("with love and fire"));
assertThat(habit.getFrequency(), equalTo(Frequency.DAILY));
assertTrue(containsRepetition(habit, 2016, 3, 18));
assertTrue(containsRepetition(habit, 2016, 3, 19));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ public void testWriteCSV() throws IOException

Habit h1 = fixtures.createEmptyHabit();
h1.setName("Meditate");
h1.setDescription("Did you meditate this morning?");
h1.setQuestion("Did you meditate this morning?");
h1.setFrequency(Frequency.DAILY);
h1.setColor(3);

Habit h2 = fixtures.createEmptyHabit();
h2.setName("Wake up early");
h2.setDescription("Did you wake up before 6am?");
h2.setQuestion("Did you wake up before 6am?");
h2.setFrequency(new Frequency(2, 3));
h2.setColor(5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testCopyRestore1()
{
Habit original = modelFactory.buildHabit();
original.setName("Hello world");
original.setDescription("Did you greet the world today?");
original.setQuestion("Did you greet the world today?");
original.setColor(1);
original.setArchived(true);
original.setFrequency(Frequency.THREE_TIMES_PER_WEEK);
Expand All @@ -58,7 +58,7 @@ public void testCopyRestore2()
{
Habit original = modelFactory.buildHabit();
original.setName("Hello world");
original.setDescription("Did you greet the world today?");
original.setQuestion("Did you greet the world today?");
original.setColor(5);
original.setArchived(false);
original.setFrequency(Frequency.DAILY);
Expand Down

0 comments on commit fb98c5f

Please sign in to comment.