fix habit importers to use description instead

This commit is contained in:
Rechee
2020-01-08 17:52:52 -08:00
parent 557ae19297
commit 88d6a8e513
5 changed files with 9 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ public class HabitBullCSVImporter extends AbstractImporter
String name = line[0];
if (name.equals("HabitName")) continue;
String question = line[1];
String description = line[1];
String dateString[] = line[3].split("-");
int year = Integer.parseInt(dateString[0]);
int month = Integer.parseInt(dateString[1]);
@@ -87,7 +87,7 @@ public class HabitBullCSVImporter extends AbstractImporter
{
h = modelFactory.buildHabit();
h.setName(name);
h.setQuestion(question);
h.setDescription(description);
h.setFrequency(Frequency.DAILY);
habitList.add(h);
map.put(name, h);

View File

@@ -92,7 +92,7 @@ public class RewireDBImporter extends AbstractImporter
{
int id = c.getInt(0);
String name = c.getString(1);
String question = c.getString(2);
String description = c.getString(2);
int schedule = c.getInt(3);
String activeDays = c.getString(4);
int repeatingCount = c.getInt(5);
@@ -101,7 +101,7 @@ public class RewireDBImporter extends AbstractImporter
Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setQuestion(question);
habit.setDescription(description);
int periods[] = { 7, 31, 365 };
int numerator, denominator;

View File

@@ -123,11 +123,11 @@ public class TickmateDBImporter extends AbstractImporter
{
int id = c.getInt(0);
String name = c.getString(1);
String question = c.getString(2);
String description = c.getString(2);
Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setQuestion(question);
habit.setDescription(description);
habit.setFrequency(Frequency.DAILY);
habitList.add(habit);

View File

@@ -148,9 +148,9 @@ public class Habit
return data.description;
}
public synchronized void setDescription(@NonNull String description)
public synchronized void setDescription(@Nullable String description)
{
data.description = description;
data.description = description == null ? "" : description;
}
@NonNull

View File

@@ -52,7 +52,7 @@ public class ImportTest extends BaseUnitTest
Habit habit = habitList.getByPosition(0);
assertThat(habit.getName(), equalTo("Breed dragons"));
assertThat(habit.getQuestion(), equalTo("with love and fire"));
assertThat(habit.getDescription(), equalTo("with love and fire"));
assertThat(habit.getFrequency(), equalTo(Frequency.DAILY));
assertTrue(containsRepetition(habit, 2016, 3, 18));
assertTrue(containsRepetition(habit, 2016, 3, 19));