mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
fix habit importers to use description instead
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user