Skip to content

Commit

Permalink
add some comments & fix test case name
Browse files Browse the repository at this point in the history
  • Loading branch information
utkuufuk committed Jun 27, 2020
1 parent c0f25fa commit 6f77191
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/habits/habits.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (s source) readCells(rangeName string) ([][]interface{}, error) {
// toCards returns a slice of trello cards from the given habits which haven't been marked today
func toCards(habits map[string]habit, label string) (cards []trello.Card, err error) {
for name, habit := range habits {
// proper cell names are 11/12 characters long on single/double digit days of month
if len(habit.CellName) != 11 && len(habit.CellName) != 12 {
return nil, fmt.Errorf("illegal habit cell name: '%s' %w", habit.CellName, err)
}
Expand All @@ -81,6 +82,7 @@ func toCards(habits map[string]habit, label string) (cards []trello.Card, err er
continue
}

// include the day of month in card title to force overwrite in the beginning of the next day
title := fmt.Sprintf("%v (%s)", name, habit.CellName[10:])
c, err := trello.NewCard(title, label, habit.CellName, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/habits/habits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestToCards(t *testing.T) {
err: errors.New(""),
},
{
name: "some marked some unhabits",
name: "some marked some unmarked habits",
label: str,
habits: map[string]habit{
"a": {cellName, "✔"},
Expand Down

0 comments on commit 6f77191

Please sign in to comment.