review_scheduler

package
v0.0.0-...-5e43dd1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Defines the Review struct for storing rows from the Review table.

Auto-tuning stuff (of spacing algorithm parameters).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkSaveReviews

func BulkSaveReviews[T database.Querier](q T, reviews []Result, now time.Time) error

Saves reviews in bulk.

func ScheduleReview

func ScheduleReview[T database.Querier](q T, due time.Time, count int) ([]string, error)

Returns items due for review, no more than count. Pass a negative count if you want to get all due items.

func ScheduleReviewNow

func ScheduleReviewNow[T database.Querier](q T, count int) ([]string, error)

Same as Schedule, but with some default args.

func ScheduleReviewNowWith

func ScheduleReviewNowWith[T database.Querier](q T, count int, pred func(item string) bool) ([]string, error)

Same as ScheduleReviewNowWith, but takes a predicate argument. Only items that satisfy the predicate are included in the result.

func UpdateReview

func UpdateReview[T database.Querier](q T, item string, correct bool) error

func UpdateReviewAt

func UpdateReviewAt[T database.Querier](q T, item string, correct bool, now time.Time) error

Updates review status of item.

func UpdateReviewAtTx

func UpdateReviewAtTx(tx *sql.Tx, result Result, now time.Time) error

Same as `UpdateReviewAt`, but explicitly takes an `*sql.Tx`.

Types

type Result

type Result struct {
	Word    string `json:"word"`
	Correct bool   `json:"correct"`
}

Review results

type Review

type Review struct {
	Interval time.Duration // Interval between now and due date
	Reviewed time.Time
}

func (Review) Correct

func (r Review) Correct() bool

func (Review) Due

func (r Review) Due() time.Time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL