func (r *Repo) DeckList(ctx context.Context) ([]*Deck, error) {
	defer profile("deck list")()
	udb, err := r.userDB(ctx)
	if err != nil {
		return nil, err
	}
	if e := checkDDocVersion(ctx, udb); e != nil {
		return nil, e
	}

	decks, err := deckReducedStats(ctx, udb)
	if err != nil {
		return nil, err
	}

	if err := fleshenDecks(ctx, udb, decks); err != nil {
		return nil, err
	}
	sort.Slice(decks, func(i, j int) bool {
		return decks[i].Name < decks[j].Name
	})
	allDeck := &Deck{
		ID:   allDeckID,
		Name: allDeckName,
	}
	for _, deck := range decks {
		allDeck.TotalCards += deck.TotalCards
		allDeck.DueCards += deck.DueCards
		allDeck.LearningCards += deck.LearningCards
		allDeck.MatureCards += deck.MatureCards
		allDeck.NewCards += deck.NewCards
		allDeck.SuspendedCards += deck.SuspendedCards
	}
	return append([]*Deck{allDeck}, decks...), nil
}
// DeckList returns a complete list of decks available for study.
DeckList returns a complete list of decks available for study.
// DeckList returns a complete list of decks available for study .
func (r *Repo) DeckList(ctx context.Context) ([]*Deck, error) {
	defer profile("deck list")()
	udb, err := r.userDB(ctx)
	if err != nil {
		return nil, err
	}
	if e := checkDDocVersion(ctx, udb); e != nil {
		return nil, e
	}
	decks, err := deckReducedStats(ctx, udb)
	if err != nil {
		return nil, err
	}
	if err := fleshenDecks(ctx, udb, decks); err != nil {
		return nil, err
	}
	sort.Slice(decks, func(i, j int) bool {
		return decks[i].Name < decks[j].Name
	})
	allDeck := &Deck{
		ID:   allDeckID,
		Name: allDeckName,
	}
	for _, deck := range decks {
		allDeck.TotalCards += deck.TotalCards
		allDeck.DueCards += deck.DueCards
		allDeck.LearningCards += deck.LearningCards
		allDeck.MatureCards += deck.MatureCards
		allDeck.NewCards += deck.NewCards
		allDeck.SuspendedCards += deck.SuspendedCards
	}
	return append([]*Deck{allDeck}, decks...), nil
}
func ( r * Repo ) DeckList ( ctx context . Context ) ( [ ] * Deck , error ) { defer profile ( " " ) ( ) udb , err := r . userDB ( ctx ) if err != nil { return nil , err } if e := checkDDocVersion ( ctx , udb ) ; e != nil { return nil , e } decks , err := deckReducedStats ( ctx , udb ) if err != nil { return nil , err } if err := fleshenDecks ( ctx , udb , decks ) ; err != nil { return nil , err } sort . Slice ( decks , func ( i , j int ) bool { return decks [ i ] . Name < decks [ j ] . Name } ) allDeck := & Deck { ID : allDeckID , Name : allDeckName , } for _ , deck := range decks { allDeck . TotalCards += deck . TotalCards allDeck . DueCards += deck . DueCards allDeck . LearningCards += deck . LearningCards allDeck . MatureCards += deck . MatureCards allDeck . NewCards += deck . NewCards allDeck . SuspendedCards += deck . SuspendedCards } return append ( [ ] * Deck { allDeck } , decks ... ) , nil }
DeckList returns a complete list of decks available for study.
DeckList returns a complete list of decks available for study .