mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -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];
|
String name = line[0];
|
||||||
if (name.equals("HabitName")) continue;
|
if (name.equals("HabitName")) continue;
|
||||||
|
|
||||||
String question = line[1];
|
String description = line[1];
|
||||||
String dateString[] = line[3].split("-");
|
String dateString[] = line[3].split("-");
|
||||||
int year = Integer.parseInt(dateString[0]);
|
int year = Integer.parseInt(dateString[0]);
|
||||||
int month = Integer.parseInt(dateString[1]);
|
int month = Integer.parseInt(dateString[1]);
|
||||||
@@ -87,7 +87,7 @@ public class HabitBullCSVImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
h = modelFactory.buildHabit();
|
h = modelFactory.buildHabit();
|
||||||
h.setName(name);
|
h.setName(name);
|
||||||
h.setQuestion(question);
|
h.setDescription(description);
|
||||||
h.setFrequency(Frequency.DAILY);
|
h.setFrequency(Frequency.DAILY);
|
||||||
habitList.add(h);
|
habitList.add(h);
|
||||||
map.put(name, h);
|
map.put(name, h);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class RewireDBImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
int id = c.getInt(0);
|
int id = c.getInt(0);
|
||||||
String name = c.getString(1);
|
String name = c.getString(1);
|
||||||
String question = c.getString(2);
|
String description = c.getString(2);
|
||||||
int schedule = c.getInt(3);
|
int schedule = c.getInt(3);
|
||||||
String activeDays = c.getString(4);
|
String activeDays = c.getString(4);
|
||||||
int repeatingCount = c.getInt(5);
|
int repeatingCount = c.getInt(5);
|
||||||
@@ -101,7 +101,7 @@ public class RewireDBImporter extends AbstractImporter
|
|||||||
|
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName(name);
|
habit.setName(name);
|
||||||
habit.setQuestion(question);
|
habit.setDescription(description);
|
||||||
|
|
||||||
int periods[] = { 7, 31, 365 };
|
int periods[] = { 7, 31, 365 };
|
||||||
int numerator, denominator;
|
int numerator, denominator;
|
||||||
|
|||||||
@@ -123,11 +123,11 @@ public class TickmateDBImporter extends AbstractImporter
|
|||||||
{
|
{
|
||||||
int id = c.getInt(0);
|
int id = c.getInt(0);
|
||||||
String name = c.getString(1);
|
String name = c.getString(1);
|
||||||
String question = c.getString(2);
|
String description = c.getString(2);
|
||||||
|
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName(name);
|
habit.setName(name);
|
||||||
habit.setQuestion(question);
|
habit.setDescription(description);
|
||||||
habit.setFrequency(Frequency.DAILY);
|
habit.setFrequency(Frequency.DAILY);
|
||||||
habitList.add(habit);
|
habitList.add(habit);
|
||||||
|
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ public class Habit
|
|||||||
return data.description;
|
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
|
@NonNull
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ImportTest extends BaseUnitTest
|
|||||||
|
|
||||||
Habit habit = habitList.getByPosition(0);
|
Habit habit = habitList.getByPosition(0);
|
||||||
assertThat(habit.getName(), equalTo("Breed dragons"));
|
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));
|
assertThat(habit.getFrequency(), equalTo(Frequency.DAILY));
|
||||||
assertTrue(containsRepetition(habit, 2016, 3, 18));
|
assertTrue(containsRepetition(habit, 2016, 3, 18));
|
||||||
assertTrue(containsRepetition(habit, 2016, 3, 19));
|
assertTrue(containsRepetition(habit, 2016, 3, 19));
|
||||||
|
|||||||
Reference in New Issue
Block a user