model

package
Version: v0.0.0-...-f2f702e Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity int

Activity enum for keeping track of user activity

const (
	/////// System logs ///////
	NewUser             Activity = 0 // A new user is created
	ChangeEmail         Activity = 1 // User changed email
	ChangePassword      Activity = 2 // User changed password (DO NOT SHOW OLD/NEW PASSWORD IN LOG)
	ChangePasswordEmail Activity = 3 // User changed password through email

	/////// Course logs ///////
	// Submission
	CreateSubmission Activity = 4 // User submission is created
	UpdateSubmission Activity = 5 // User submission is updated
	DeleteSubmission Activity = 6 // User submission is deleted
	// Review
	FinishedOnePeerReview Activity = 7 // User is done with one peer review (that this user did)
	UpdateOnePeerReview   Activity = 8 // User changed one peer review
	// Course
	JoinedCourse Activity = 9  // User joined course
	LeftCourse   Activity = 10 // USer left course
	// Group
	CreateGroup     Activity = 11 // User created group
	EditGroupName   Activity = 12 // User edited group name
	DeleteGroup     Activity = 13 // User deleted group
	JoinGroup       Activity = 14 // User joined group
	LeftGroup       Activity = 15 // User left group
	KickedFromGroup Activity = 16 // User kicked from group

	/////// Admin logs ///////
	// Assignment
	AdminCreateAssignment Activity = 100 // Admin assignment is created
	AdminDeleteAssignment Activity = 101 // Admin assignment is deleted
	AdminUpdateAssignment Activity = 102 // Admin assignment is updated
	// Forms
	AdminCreateSubmissionForm Activity = 103 // Admin submission form is created
	AdminUpdateSubmissionForm Activity = 104 // Admin submission form is updated
	AdminDeleteSubmissionForm Activity = 105 // Admin submission form is deleted
	AdminCreateReviewForm     Activity = 106 // Admin review form is created
	AdminUpdateReviewForm     Activity = 107 // Admin review form is updated
	AdminDeleteReviewForm     Activity = 108 // Admin review form is deleted
	// Course
	AdminCreatedCourse Activity = 109 // Admin course is created
	AdminUpdateCourse  Activity = 110 // Admin course is updated
	AdminDeleteCourse  Activity = 111 // Admin course is deleted
	// FAQ
	AdminCreateFAQ Activity = 112 // Admin FAQ is created
	AdminUpdateFAQ Activity = 113 // Admin FAQ is updated
	// Manage students
	AdminEmailCourseStudents     Activity = 114 // Admin emailed all students in course through the system
	AdminRemoveUserFromCourse    Activity = 115 // Admin removed one user from course
	AdminChangeStudentPassword   Activity = 116 // Admin changed one users password
	AdminCreateSubmissionForUser Activity = 117 // Admin created submission for user
	AdminUpdateSubmissionForUser Activity = 118 // Admin updated submission for user
	AdminDeleteSubmissionForUser Activity = 119 // Admin deleted submission for user
	AdminAddUserToGroup          Activity = 120 // Admin added user to group
	AdminRemoveUserFromGroup     Activity = 121 // Admin removed user from group
	AdminEditGroupName           Activity = 122 // Admin edited group name
	AdminDeleteGroup             Activity = 123 // Admin deleted group
	AdminCreateGroup             Activity = 124 // Admin created group
)

Enum for logs user is 0-16 and admin is 100 - 124

type Answer

type Answer struct {
	ID      int
	Type    string
	Value   string
	Comment sql.NullString
}

Answer struct used for storing answers from users in forms

type Assignment

type Assignment struct {
	ID             int           `json:"id" db:"id"`
	Name           string        `json:"name" db:"name"`
	Description    string        `json:"description" db:"description"`
	Created        time.Time     `json:"created" db:"created"`
	Publish        time.Time     `json:"publish" db:"publish"`
	Deadline       time.Time     `json:"deadline" db:"deadline"`
	CourseID       int           `json:"course_id" db:"course_id"`
	SubmissionID   sql.NullInt64 `json:"-" db:"submission_id"`
	ReviewID       sql.NullInt64 `json:"-" db:"review_id"`
	Submission     Submission    `json:"submission"`
	Review         Review        `json:"review"`
	ReviewEnabled  bool          `json:"review_enabled"`
	ReviewDeadline time.Time     `json:"review_deadline"`
	Reviewers      sql.NullInt64 `json:"reviewers"`
	ValidationID   sql.NullInt64 `json:"validation_id"`
	GroupDelivery  bool          `json:"group_delivery"`
}

Assignment hold the data for a single assignment

type Course

type Course struct {
	ID          int          `json:"id"`
	Hash        string       `json:"hash"`
	Code        string       `json:"code"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Teacher     int          `json:"teacher"`
	Year        string       `json:"year"`
	Semester    string       `json:"semester"`
	Assignments []Assignment `json:"assignments"`
}

Course holds the data for courses

type Faq

type Faq struct {
	ID        int       `json:"id"`
	Timestamp time.Time `json:"timestamp"`
	Questions string    `json:"questions"`
}

Faq Struct for keeping the frequently asked questions under /admin/faq

type Field

type Field struct {
	ID          int      `json:"id"`
	FormID      int      `json:"form_id"`
	Type        string   `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Label       string   `json:"label"`
	HasComment  bool     `json:"hasComment"`
	Order       int      `json:"order"`
	Weight      int      `json:"weight,omitempty"`
	Choices     []string `json:"choices,omitempty"`
	Required    bool     `json:"required"`
}

Field struct

type Form

type Form struct {
	ID      int       `json:"id" db:"id"`
	Prefix  string    `json:"prefix" db:"prefix"`
	Name    string    `json:"name" db:"name"`
	Created time.Time `json:"created" db:"created"`
	Fields  []Field   `json:"fields"`
}

Form struct

type FormRepositoryOld

type FormRepositoryOld struct{}

FormRepositoryOld struct

func (*FormRepositoryOld) Get

func (repo *FormRepositoryOld) Get(id int) (Form, error)

Get a single form based on the Primary Key, 'id'

func (*FormRepositoryOld) GetReviewFormFromAssignmentID

func (repo *FormRepositoryOld) GetReviewFormFromAssignmentID(assignmentID int) (Form, error)

GetReviewFormFromAssignmentID get review-form from the assignment id key

func (*FormRepositoryOld) GetSubmissionFormFromAssignmentID

func (repo *FormRepositoryOld) GetSubmissionFormFromAssignmentID(assignmentID int) (Form, error)

GetSubmissionFormFromAssignmentID get form from the assignment id key

func (*FormRepositoryOld) Insert

func (repo *FormRepositoryOld) Insert(form Form) (int, error)

Insert form to database

type FullReview

type FullReview struct {
	Reviewer     int // User that is doing the review
	Target       int // User that is getting the review
	ReviewID     int
	AssignmentID int
	Answers      []ReviewAnswer
}

FullReview holds specific data about an review for displaying it

type Group

type Group struct {
	ID           int    `json:"id"`
	AssignmentID int    `json:"assignment_id"`
	Name         string `json:"name"`
	Users        []User `json:"users"`
	Creator      int    `json:"creator"`
}

Group struct

type Logs

type Logs struct {
	ID             int            `json:"id"`               // [NOT NULL][all]
	UserID         int            `json:"user_id"`          // [NOT NULL][all]
	UserName       sql.NullString `json:"user_name"`        // [NULLABLE]
	UserRole       sql.NullInt64  `json:"user_role"`        // [NULLABLE]
	Timestamp      time.Time      `json:"timestamp"`        // [NOT NULL][all]
	Activity       Activity       `json:"activity"`         // [NOT NULL][all]
	AssignmentID   sql.NullInt64  `json:"assignment_id"`    // [NULLABLE]
	CourseID       sql.NullInt64  `json:"course_id"`        // [NULLABLE]
	SubmissionID   sql.NullInt64  `json:"submission_id"`    // [NULLABLE]
	ReviewID       sql.NullInt64  `json:"review_id"`        // [NULLABLE]
	GroupID        sql.NullInt64  `json:"group_id"`         // [NULLABLE]
	OldValue       sql.NullString `json:"old_value"`        // [NULLABLE]
	NewValue       sql.NullString `json:"new_value"`        // [NULLABLE]
	AffectedUserID sql.NullInt64  `json:"affected_user_id"` // [NULLABLE]
}

Logs struct for keeping logs data

type PeerReview

type PeerReview struct {
	ID           int
	ReviewerID   int    // User that is doing the review
	TargetID     int    // User that is getting the review
	ReviewerName string // User that is doing the review
	TargetName   string // User that is getting the review
	AssignmentID int
}

PeerReview struct

type ProcessedAssignmentReport

type ProcessedAssignmentReport struct {
	UserReports []ProcessedUserReport `json:"user_reports"`
}

ProcessedAssignmentReport struct

func (*ProcessedAssignmentReport) ExportCSV

func (par *ProcessedAssignmentReport) ExportCSV() (string, error)

ExportCSV func

type ProcessedReviewItem

type ProcessedReviewItem struct {
	Mean   float64 `json:"mean"`
	StdDev float64 `json:"std_dev"`
}

ProcessedReviewItem struct

type ProcessedUserReport

type ProcessedUserReport struct {
	Name         string                `json:"name"`
	Email        string                `json:"email"`
	ReviewsDone  int                   `json:"reviews_done"`
	ReviewItems  []ProcessedReviewItem `json:"review_items"`
	ReviewMark   float64               `json:"review_mark"`
	ReviewStdDev float64               `json:"review_std_dev"`
}

ProcessedUserReport struct

type RawUserReport

type RawUserReport struct {
	Name         string      `json:"name"`
	Email        string      `json:"email"`
	ReviewsDone  int         `json:"reviews_done"`
	ReviewScores [][]float64 `json:"review_scores"`
}

RawUserReport struct

func (*RawUserReport) Process

func (raw *RawUserReport) Process() (*ProcessedUserReport, error)

Process raw user report to processed user report

type Review

type Review struct {
	ID     int  `json:"id" db:"id"`
	FormID int  `json:"-" db:"form_id"`
	Form   Form `json:"form"`
}

Review struct

type ReviewAnswer

type ReviewAnswer struct {
	ID           int            `json:"id"`
	UserReviewer int            `json:"user_reviewer"`
	UserTarget   int            `json:"user_target"`
	AssignmentID int            `json:"assignment_id"`
	ReviewID     int            `json:"review_id"`
	Type         string         `json:"type"`
	Name         string         `json:"name"`
	Label        string         `json:"label"`
	Description  string         `json:"description"`
	Answer       string         `json:"answer"`
	HasComment   bool           `json:"has_comment"`
	Comment      sql.NullString `json:"comment"`
	Choices      []string       `json:"choices"`
	Submitted    time.Time      `json:"submitted"`
	Weight       int            `json:"weight"`
	Required     bool           `json:"required"`
}

ReviewAnswer holds the data for a single review answer

type Submission

type Submission struct {
	ID     int  `json:"id" db:"id"`
	FormID int  `json:"-" db:"form_id"`
	Form   Form `json:"form"`
}

Submission struct

type SubmissionAnswer

type SubmissionAnswer struct {
	ID           int            `json:"id"`
	UserID       int            `json:"user_id"`
	AssignmentID int            `json:"assignment_id"`
	SubmissionID int            `json:"submission_id"`
	Type         string         `json:"type"`
	Name         string         `json:"name"`
	Label        string         `json:"label"`
	Description  string         `json:"description"`
	Answer       string         `json:"answer"`
	HasComment   bool           `json:"has_comment"`
	Comment      sql.NullString `json:"comment"`
	Choices      []string       `json:"choices"`
	Submitted    time.Time      `json:"submitted"`
	Weight       int            `json:"weight"`
	Required     bool           `json:"required"`
}

SubmissionAnswer struct

type User

type User struct {
	ID            int            `json:"id"`
	Name          string         `json:"name"`
	EmailStudent  string         `json:"emailstudent"`
	EmailPrivate  sql.NullString `json:"emailprivate,omitempty"`
	Teacher       bool           `json:"teacher"`
	Authenticated bool           `json:"authenticated"`
}

User struct to hold session data

type UserRegistrationPending

type UserRegistrationPending struct {
	ID           int            `json:"id"`
	Name         sql.NullString `json:"name"`
	Email        string         `json:"email"`
	Password     sql.NullString `json:"password"`
	ValidationID int            `json:"validation_id"`
}

UserRegistrationPending struct for keeping data for the table user_pending

type UserSubmission

type UserSubmission struct {
	UserID       int
	AssignmentID int
	SubmissionID int64
	Answers      []Answer
	Submitted    time.Time
}

UserSubmission is an struct for user submissions

type ValidationEmail

type ValidationEmail struct {
	ID        int           `json:"id"`
	Hash      string        `json:"hash"`
	UserID    sql.NullInt64 `json:"userid"`
	Valid     bool          `json:"valid"`
	TimeStamp time.Time     `json:"timestamp"`
}

ValidationEmail struct for keeping the data for the validation table for confirming email address, forgotten password and adding secondary email

Jump to

Keyboard shortcuts

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