func (r *Repo) GetCardToStudy(ctx context.Context, deck string) (flashback.CardView, error) {
	if _, _, err := r.lastSyncTime(ctx); err != nil {
		if kivik.StatusCode(err) == kivik.StatusNotFound {
			return mustsync.GetCard(), nil
		}
		return nil, err
	}
	card, err := r.getCardToStudy(ctx, deck)
	if err != nil {
		return nil, err
	}
	if err == nil && card == nil {
		return done.GetCard(), nil
	}
	go func() {
		// Bury related cards
		if err := r.BuryRelatedCards(ctx, card.Card); err != nil {
			log.Printf("Failed to bury cards: %s\n", err)
		}
	}()

	return card, nil
}
// GetCardToStudy returns a CardView to display to the user to study, and buries
// related cards.
GetCardToStudy returns a CardView to display to the user to study, and buries
related cards.
// GetCardToStudy returns a CardView to display to the user to study and buries // related cards .
func (r *Repo) GetCardToStudy(ctx context.Context, deck string) (flashback.CardView, error) {
	if _, _, err := r.lastSyncTime(ctx); err != nil {
		if kivik.StatusCode(err) == kivik.StatusNotFound {
			return mustsync.GetCard(), nil
		}
		return nil, err
	}
	card, err := r.getCardToStudy(ctx, deck)
	if err != nil {
		return nil, err
	}
	if err == nil && card == nil {
		return done.GetCard(), nil
	}
	go func() {
		if err := r.BuryRelatedCards(ctx, card.Card); err != nil {
			log.Printf("Failed to bury cards: %s\n", err)
		}
	}()
	return card, nil
}
func ( r * Repo ) GetCardToStudy ( ctx context . Context , deck string ) ( flashback . CardView , error ) { if _ , _ , err := r . lastSyncTime ( ctx ) ; err != nil { if kivik . StatusCode ( err ) == kivik . StatusNotFound { return mustsync . GetCard ( ) , nil } return nil , err } card , err := r . getCardToStudy ( ctx , deck ) if err != nil { return nil , err } if err == nil && card == nil { return done . GetCard ( ) , nil } go func ( ) { if err := r . BuryRelatedCards ( ctx , card . Card ) ; err != nil { log . Printf ( " \n " , err ) } } ( ) return card , nil }
GetCardToStudy returns a CardView to display to the user to study, and buries
related cards.
GetCardToStudy returns a CardView to display to the user to study and buries related cards .
// Bury related cards