Esempio n. 1
0
func (store FolderStore) ListProjects(showarchive bool) (data.Projects, error) {
	db := store.db()
	keys, err := db.Keys()
	if err != nil {
		return data.Projects{}, errgo.Notef(err, "can not get keys from database")
	}

	out := data.NewProjects()
	for _, key := range keys {
		if !showarchive {
			// Skipping archived projects
			if len(key) > 0 {
				log.Debug("Key: ", key[0])

				if key[0] == ".archive" {
					continue
				}
			}
		}

		name := data.ProjectName(key)
		out.Add(data.Project{Name: name})
	}

	return out, nil
}
Esempio n. 2
0
func GetTestProject(suffix string, notes, todos int) data.Project {
	project := data.Project{
		Name: data.ProjectName([]string{"Test", "Project", suffix}),
	}

	for i := 0; i != notes; i++ {
		project.AddNote(GetTestNote(i, "note note note"))
	}

	for i := 0; i != todos; i++ {
		project.AddTodo(data.Todo{
			TimeStamp: time.Date(2010+i, time.November, 10, 23, 0, 0, 0, time.UTC),
			Value:     "todo todo todo",
			Active:    true,
		})
	}

	return project
}