database

package
v0.0.0-...-ed50d38 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB // other packages can access this variable
View Source
var DBLock sync.Mutex

Functions

func AddAssignmentToClassroom

func AddAssignmentToClassroom(assignment *models.Assignment, classroom *models.Classroom) error

func AddStudentToAssignmentBlacklist

func AddStudentToAssignmentBlacklist(userID, assignmentID uint) error

func AddUserToClassroom

func AddUserToClassroom(UserID uint, ClassroomCode string, IsTeacher bool) error

func ChangeActiveStatusInstantTest

func ChangeActiveStatusInstantTest(active bool, privateCode string) (err error)

func Connect

func Connect(dsn string) (*gorm.DB, error)

func CreateClassroom

func CreateClassroom(Name string, TeacherID uint) (*models.Classroom, error)

func CreateInstantTest

func CreateInstantTest(questions []models.Question, email string) (privateCode, publicCode string, err error)

func CreateNewUser

func CreateNewUser(UniversityID string, Name string, Email string, Password string, IsTeacher bool) (err error)

func ExcuseStudentFromAssignmentBlacklist

func ExcuseStudentFromAssignmentBlacklist(userID, assignmentID uint) error

func GetAssignment

func GetAssignment(assignmentID uint) (*models.Assignment, error)

func GetAssignmentBlacklist

func GetAssignmentBlacklist(assignmentID uint) ([]models.User, error)

this function returns the list of students that are blacklisted from an assignment

func GetAssignmentForAIVerification

func GetAssignmentForAIVerification(assignmentID uint) (models.Assignment, error)

The difference between this function and GetAssignment is that this also fetches test cases, submissions, etc

func GetAssignmentForEdit

func GetAssignmentForEdit(assignmentID uint) (models.Assignment, error)

func GetAssignmentSubmissionPerStudent

func GetAssignmentSubmissionPerStudent(assignmentID, userID uint) (submission models.AssignmentSubmission, questionIDs []uint, questions []models.Question, err error)

func GetAssignmentSubmissions

func GetAssignmentSubmissions(assignmentID uint) (submissions []models.AssignmentSubmission, questionIDs []uint, err error)

func GetClassroom

func GetClassroom(ClassroomCode string) (*models.Classroom, error)

func GetClassroomByID

func GetClassroomByID(classroomID uint) (*models.Classroom, error)

func GetInstantTest

func GetInstantTest(publicCode string) (questions []models.Question, isActive bool, err error)

func GetInstantTestByPrivateCode

func GetInstantTestByPrivateCode(privateCode string) (models.InstantTest, error)

func GetInstantTestSubmissions

func GetInstantTestSubmissions(privateCode string) ([]models.InstantTestSubmission, []uint, bool, error)

This function fetches all submissions in a given instant test and returns it as an array it also returns an array of questionIDs and a boolean stating if the test is active

func GetUserByID

func GetUserByID(userID uint) (user models.User, err error)

func GetUserByUniversityIDPassword

func GetUserByUniversityIDPassword(UniversityID string, Password string) (user models.User, err error)

func SaveAssignment

func SaveAssignment(assignment models.Assignment) error

func SaveInstantTest

func SaveInstantTest(instantTest models.InstantTest) error

func SetVivaScore

func SetVivaScore(assignmentID, userID, questionID uint, score int) error

func UpsertAssignmentSubmissionAndAnswers

func UpsertAssignmentSubmissionAndAnswers(assignmentID uint, userID uint, universityID string, newAnswer models.Answer) (uint, error)

the below function is used to update the submission and answers of a student if the submission exists, we update it. If not, it's created

func UpsertSubmissionAndAnswers

func UpsertSubmissionAndAnswers(instantTestID uint, universityID string, newAnswer models.Answer) error

the below function is used to update the submission and answers of a student if the submission exists, we update it. If not, it's created

Types

This section is empty.

Jump to

Keyboard shortcuts

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