mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
now writing question and description to csv
This commit is contained in:
@@ -212,6 +212,7 @@ public abstract class HabitList implements Iterable<Habit>
|
||||
String header[] = {
|
||||
"Position",
|
||||
"Name",
|
||||
"Question",
|
||||
"Description",
|
||||
"NumRepetitions",
|
||||
"Interval",
|
||||
@@ -229,6 +230,7 @@ public abstract class HabitList implements Iterable<Habit>
|
||||
String.format("%03d", indexOf(habit) + 1),
|
||||
habit.getName(),
|
||||
habit.getQuestion(),
|
||||
habit.getDescription(),
|
||||
Integer.toString(freq.getNumerator()),
|
||||
Integer.toString(freq.getDenominator()),
|
||||
ColorConstants.CSV_PALETTE[habit.getColor()]
|
||||
|
||||
@@ -219,12 +219,14 @@ public class HabitListTest extends BaseUnitTest
|
||||
Habit h1 = fixtures.createEmptyHabit();
|
||||
h1.setName("Meditate");
|
||||
h1.setQuestion("Did you meditate this morning?");
|
||||
h1.setDescription("this is a test description");
|
||||
h1.setFrequency(Frequency.DAILY);
|
||||
h1.setColor(3);
|
||||
|
||||
Habit h2 = fixtures.createEmptyHabit();
|
||||
h2.setName("Wake up early");
|
||||
h2.setQuestion("Did you wake up before 6am?");
|
||||
h2.setDescription(null);
|
||||
h2.setFrequency(new Frequency(2, 3));
|
||||
h2.setColor(5);
|
||||
|
||||
@@ -232,9 +234,9 @@ public class HabitListTest extends BaseUnitTest
|
||||
list.add(h2);
|
||||
|
||||
String expectedCSV =
|
||||
"Position,Name,Description,NumRepetitions,Interval,Color\n" +
|
||||
"001,Meditate,Did you meditate this morning?,1,1,#FF8F00\n" +
|
||||
"002,Wake up early,Did you wake up before 6am?,2,3,#AFB42B\n";
|
||||
"Position,Name,Question,Description,NumRepetitions,Interval,Color\n" +
|
||||
"001,Meditate,Did you meditate this morning?,this is a test description,1,1,#FF8F00\n" +
|
||||
"002,Wake up early,Did you wake up before 6am?,,2,3,#AFB42B\n";
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
list.writeCSV(writer);
|
||||
|
||||
Reference in New Issue
Block a user