Documentation
¶
Overview ¶
Package review provides intelligent memo review system based on spaced repetition.
Package review - service implementation for P3-C002.
Index ¶
- Constants
- type ReviewConfig
- type ReviewItem
- type ReviewQuality
- type ReviewState
- type ReviewStats
- type Service
- func (s *Service) GetDueReviews(ctx context.Context, userID int32, limit int) ([]ReviewItem, int, error)
- func (s *Service) GetReviewStats(ctx context.Context, userID int32) (*ReviewStats, error)
- func (s *Service) RecordReview(ctx context.Context, userID int32, memoUID string, quality ReviewQuality) error
Constants ¶
const DefaultEaseFactor = 2.5
DefaultEaseFactor is the initial ease factor for new items.
const MinEaseFactor = 1.3
MinEaseFactor is the minimum ease factor to prevent intervals from getting too short.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReviewConfig ¶
type ReviewConfig struct {
MaxDailyReviews int
NewCardsPerDay int
DailyReviewTime int
EnableNotifications bool
}
ReviewConfig contains configuration for the review system.
func DefaultConfig ¶
func DefaultConfig() ReviewConfig
DefaultConfig returns the default review configuration.
type ReviewItem ¶
type ReviewItem struct {
LastReview time.Time `json:"last_review"`
NextReview time.Time `json:"next_review"`
CreatedAt time.Time `json:"created_at"`
MemoID string `json:"memo_id"`
MemoName string `json:"memo_name"`
Title string `json:"title"`
Snippet string `json:"snippet"`
Tags []string `json:"tags"`
ReviewCount int `json:"review_count"`
Priority float64 `json:"priority"`
}
ReviewItem represents a memo in the review queue.
type ReviewQuality ¶
type ReviewQuality int
ReviewQuality represents the user's assessment of recall difficulty.
const ( // QualityAgain - complete blackout, wrong response. QualityAgain ReviewQuality = 0 // QualityHard - correct but with serious difficulty. QualityHard ReviewQuality = 1 // QualityGood - correct with some hesitation. QualityGood ReviewQuality = 2 // QualityEasy - perfect response. QualityEasy ReviewQuality = 3 )
type ReviewState ¶
type ReviewState struct {
LastReview time.Time `json:"last_review"`
NextReview time.Time `json:"next_review"`
MemoUID string `json:"memo_uid"`
ReviewCount int `json:"review_count"`
EaseFactor float64 `json:"ease_factor"`
IntervalDays int `json:"interval_days"`
}
ReviewState stores the spaced repetition state for a memo.
type ReviewStats ¶
type ReviewStats struct {
TotalMemos int `json:"total_memos"`
DueToday int `json:"due_today"`
ReviewedToday int `json:"reviewed_today"`
NewMemos int `json:"new_memos"`
MasteredMemos int `json:"mastered_memos"` // interval > 30 days
StreakDays int `json:"streak_days"`
TotalReviews int `json:"total_reviews"`
AverageAccuracy int `json:"average_accuracy"` // percentage
}
ReviewStats contains statistics about the user's review progress.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides intelligent memo review functionality.
func NewServiceWithConfig ¶
func NewServiceWithConfig(s *store.Store, config ReviewConfig) *Service
NewServiceWithConfig creates a service with custom configuration.
func (*Service) GetDueReviews ¶
func (s *Service) GetDueReviews(ctx context.Context, userID int32, limit int) ([]ReviewItem, int, error)
GetDueReviews returns memos that are due for review, sorted by priority. Returns items (limited), total count of all due items, and error.
func (*Service) GetReviewStats ¶
GetReviewStats returns statistics about the user's review progress.
func (*Service) RecordReview ¶
func (s *Service) RecordReview(ctx context.Context, userID int32, memoUID string, quality ReviewQuality) error
RecordReview records a review and updates the spaced repetition state.