Documentation
¶
Index ¶
- func CountQueuedSubmissionsBefore(db *gorm.DB, cluster string, createdAt time.Time) (int64, error)
- func CreateContainer(db *gorm.DB, container *models.Container) error
- func CreateSubmission(db *gorm.DB, sub *models.Submission) error
- func CreateUser(db *gorm.DB, user *models.User) error
- func DeleteUser(db *gorm.DB, userID string) error
- func GetAllContainers(db *gorm.DB, filters map[string]string, limit, offset int) ([]models.Container, int64, error)
- func GetAllSubmissions(db *gorm.DB) ([]models.Submission, error)
- func GetAllUsers(db *gorm.DB) ([]models.User, error)
- func GetBestScoresByUserID(db *gorm.DB, userID string) ([]models.UserProblemBestScore, error)
- func GetContainer(db *gorm.DB, id string) (*models.Container, error)
- func GetScoreHistoriesForUsers(db *gorm.DB, contestID string, userIDs []string) (map[string][]UserScoreHistoryPoint, error)
- func GetSubmission(db *gorm.DB, id string) (*models.Submission, error)
- func GetSubmissionCount(db *gorm.DB, userID, contestID, problemID string) (int, error)
- func GetSubmissionsByUserID(db *gorm.DB, userID string) ([]models.Submission, error)
- func GetUserByGitLabID(db *gorm.DB, gitlabID string) (*models.User, error)
- func GetUserByID(db *gorm.DB, id string) (*models.User, error)
- func GetUserByUsername(db *gorm.DB, username string) (*models.User, error)
- func IncrementSubmissionCount(db *gorm.DB, userID, contestID, problemID string) error
- func Init(dsn string) (*gorm.DB, error)
- func IsUserRegisteredForContest(db *gorm.DB, userID, contestID string) (bool, error)
- func RecalculateScoresForUserProblem(db *gorm.DB, userID, problemID, contestID, sourceSubmissionID string, ...) error
- func RecoverInterrupted(db *gorm.DB) error
- func RegisterForContest(db *gorm.DB, userID, contestID string) error
- func UpdateContainer(db *gorm.DB, container *models.Container) error
- func UpdateScoresForNewSubmission(db *gorm.DB, sub *models.Submission, contestID string, newScore int) error
- func UpdateScoresForPerformanceSubmission(db *gorm.DB, sub *models.Submission, contestID string, maxPerformanceScore int) error
- func UpdateSubmission(db *gorm.DB, sub *models.Submission) error
- func UpdateSubmissionValidity(db *gorm.DB, id string, isValid bool) error
- func UpdateUser(db *gorm.DB, user *models.User) error
- type LeaderboardEntry
- type UserScoreHistoryPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountQueuedSubmissionsBefore ¶
CountQueuedSubmissionsBefore counts the number of submissions in the queue for a specific cluster that were created before a given time.
func CreateContainer ¶
Container CRUD
func CreateSubmission ¶
func CreateSubmission(db *gorm.DB, sub *models.Submission) error
Submission CRUD
func GetAllContainers ¶
func GetAllSubmissions ¶
func GetAllSubmissions(db *gorm.DB) ([]models.Submission, error)
func GetBestScoresByUserID ¶
func GetScoreHistoriesForUsers ¶
func GetScoreHistoriesForUsers(db *gorm.DB, contestID string, userIDs []string) (map[string][]UserScoreHistoryPoint, error)
GetScoreHistoriesForUsers retrieves the score change history for a given list of users in a specific contest.
func GetSubmission ¶
func GetSubmissionCount ¶
func GetSubmissionsByUserID ¶
func RecalculateScoresForUserProblem ¶
func RecalculateScoresForUserProblem(db *gorm.DB, userID, problemID, contestID, sourceSubmissionID string, scoreMode string, maxPerformanceScore int) error
RecalculateScoresForUserProblem recalculates scores after a submission's validity has changed. It implements distinct, comprehensive logic for both "score" and "performance" modes. sourceSubmissionID is the ID of the submission whose validity was just changed.
func RecoverInterrupted ¶
func UpdateSubmission ¶
func UpdateSubmission(db *gorm.DB, sub *models.Submission) error
Types ¶
type LeaderboardEntry ¶
type LeaderboardEntry struct {
UserID string `json:"user_id"`
Username string `json:"username"`
Tags string `json:"tags"`
Nickname string `json:"nickname"`
AvatarURL string `json:"avatar_url"`
DisableRank bool `json:"disable_rank"`
TotalScore int `json:"total_score"`
ProblemScores map[string]int `json:"problem_scores"`
// contains filtered or unexported fields
}
func GetLeaderboard ¶
GetLeaderboard retrieves the leaderboard for a contest, optionally filtered by user tags. selectedTags is a comma-separated string of tags. If empty, no tag filtering is applied.
type UserScoreHistoryPoint ¶
type UserScoreHistoryPoint struct {
Time time.Time `json:"time"`
Score int `json:"score"`
ProblemID string `json:"problem_id"`
}
UserScoreHistoryPoint represents a single point in a user's score history for a contest.
func GetScoreHistoryForUser ¶
func GetScoreHistoryForUser(db *gorm.DB, contestID string, userID string) ([]UserScoreHistoryPoint, error)
GetScoreHistoryForUser retrieves the score change history for a specific user in a specific contest.