puzzles

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnansweredCondition = " AND (correct IS NOT NULL)"
View Source
var UnratedCondition = " AND (correct IS NOT NULL OR attempts != 0)"
View Source
var UnseenCondition = ""

Functions

func AnswerBytesToGameEvent

func AnswerBytesToGameEvent(abts []byte) (*macondopb.GameEvent, error)

Types

type DBStore

type DBStore struct {
	// contains filtered or unexported fields
}

func NewDBStore

func NewDBStore(p *pgxpool.Pool) (*DBStore, error)

func (*DBStore) CreateGenerationLog

func (s *DBStore) CreateGenerationLog(ctx context.Context, req *puzzle_service.PuzzleGenerationJobRequest) (int, error)

func (*DBStore) CreatePuzzle

func (s *DBStore) CreatePuzzle(ctx context.Context, gameUUID string, turnNumber int32, answer *macondopb.GameEvent, authorUUID string,
	lexicon string, beforeText string, afterText string, tags []macondopb.PuzzleTag, generationId int, bucketIndex int32) error

func (*DBStore) Disconnect

func (s *DBStore) Disconnect()

func (*DBStore) GetAnswer

func (*DBStore) GetAttempts

func (s *DBStore) GetAttempts(ctx context.Context, userUUID string, puzzleUUID string) (bool, bool, int32, *bool, time.Time, time.Time, *entity.SingleRating, *entity.SingleRating, error)

func (*DBStore) GetJobInfo

func (s *DBStore) GetJobInfo(ctx context.Context, genId int) (time.Time, time.Time, time.Duration, *bool, *string, int, int, [][]int, error)

func (*DBStore) GetJobLogs

func (s *DBStore) GetJobLogs(ctx context.Context, limit, offset int) ([]*puzzle_service.PuzzleJobLog, error)

func (*DBStore) GetNextClosestRatingPuzzleId

func (s *DBStore) GetNextClosestRatingPuzzleId(ctx context.Context, userId string, lexicon string, ratingKey entity.VariantKey) (string, puzzle_service.PuzzleQueryResult, error)

func (*DBStore) GetNextPuzzleId

func (s *DBStore) GetNextPuzzleId(ctx context.Context, userUUID string, lexicon string) (string, puzzle_service.PuzzleQueryResult, error)

func (*DBStore) GetPotentialPuzzleGames

func (s *DBStore) GetPotentialPuzzleGames(ctx context.Context, time1, time2 time.Time,
	limit int, lexicon string, avoidBots bool) ([]pgtype.Text, error)

func (*DBStore) GetPreviousPuzzleId

func (s *DBStore) GetPreviousPuzzleId(ctx context.Context, userUUID string, puzzleUUID string) (string, error)

func (*DBStore) GetPuzzle

func (*DBStore) GetStartPuzzleId

func (s *DBStore) GetStartPuzzleId(ctx context.Context, userUUID string, lexicon string, ratingKey entity.VariantKey) (string, puzzle_service.PuzzleQueryResult, error)

func (*DBStore) GetUserRating

func (s *DBStore) GetUserRating(ctx context.Context, userID string, ratingKey entity.VariantKey) (*entity.SingleRating, error)

func (*DBStore) SetPuzzleVote

func (s *DBStore) SetPuzzleVote(ctx context.Context, userID string, puzzleID string, vote int) error

func (*DBStore) SubmitAnswer

func (s *DBStore) SubmitAnswer(ctx context.Context, userUUID string, ratingKey entity.VariantKey,
	newUserRating *entity.SingleRating, puzzleUUID string, newPuzzleRating *entity.SingleRating, userIsCorrect bool, showSolution bool) error

func (*DBStore) UpdateGenerationLogStatus

func (s *DBStore) UpdateGenerationLogStatus(ctx context.Context, id int, fulfilled bool, procErr error) error

Jump to

Keyboard shortcuts

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