models

package
v0.0.0-...-e75809f Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const QuestionResponseSeparator = ","

QuestionResponseSeparator ...

Variables

View Source
var FeedbackFormStatusValues = [...]string{
	"Draft",
	"Published",
}

FeedbackFormStatusValues ...

View Source
var FeedbackStatusValues = [...]string{
	"New",
	"In Progress",
	"Submitted",
}

FeedbackStatusValues ...

View Source
var QuestionTypeValues = [...]string{
	"Multi Choice",
	"Grade",
	"Boolean",
}

QuestionTypeValues ...

Functions

func GetQuestionResponseList

func GetQuestionResponseList(questionResponse string) []string

GetQuestionResponseList ...

func RegisterFeedbackFormToAdmin

func RegisterFeedbackFormToAdmin(Admin *admin.Admin, config admin.Config)

RegisterFeedbackFormToAdmin ...

func RegisterFeedbackToAdmin

func RegisterFeedbackToAdmin(Admin *admin.Admin, config admin.Config)

RegisterFeedbackToAdmin ...

func RegisterQuestionToAdmin

func RegisterQuestionToAdmin(Admin *admin.Admin, config admin.Config)

RegisterQuestionToAdmin ...

func RegisterSkillToAdmin

func RegisterSkillToAdmin(Admin *admin.Admin, config admin.Config)

RegisterSkillToAdmin ...

func SetQuestionRelatedFieldMeta

func SetQuestionRelatedFieldMeta(res *admin.Resource)

SetQuestionRelatedFieldMeta ...

func ValidateResponseRegex

func ValidateResponseRegex(questionResponse string) bool

ValidateResponseRegex ...

Types

type Category

type Category struct {
	gorm.Model
	Title       string `gorm:"type:varchar(255); not null"`
	Description string `gorm:"type:text"`
}

Category represent a category in feedback form

type Feedback

type Feedback struct {
	gorm.Model
	FeedbackForm     FeedbackForm
	Title            string `gorm:"type:varchar(255); not null"`
	FeedbackFormID   uint   `gorm:"not null"`
	ForUserProfile   userModels.UserProfile
	ForUserProfileID uint
	ByUserProfile    userModels.UserProfile
	ByUserProfileID  uint `gorm:"not null"`
	Team             userModels.Team
	TeamID           uint           `gorm:"not null"`
	Status           FeedbackStatus `gorm:"default:0; not null"`
	SubmittedAt      *time.Time
	DurationStart    time.Time `gorm:"not null"`
	DurationEnd      time.Time `gorm:"not null"`
	ExpireAt         time.Time `gorm:"not null"`
}

Feedback represent a submitted/in-progress feedback form by a user

type FeedbackForm

type FeedbackForm struct {
	gorm.Model
	Title       string             `gorm:"type:varchar(255); not null"`
	Description string             `gorm:"type:text;"`
	Status      FeedbackFormStatus `gorm:"default:0; not null"`
	Archive     bool               `gorm:"default:false; not null"`
}

FeedbackForm represent template form for feedback TODO Add support for versioning

type FeedbackFormContent

type FeedbackFormContent struct {
	gorm.Model
	FeedbackForm   FeedbackForm
	FeedbackFormID uint `gorm:"not null"`
	Skill          Skill
	SkillID        uint `gorm:"not null"`
	Category       Category
	CategoryID     uint `gorm:"not null"`
}

FeedbackFormContent represent the content of the feedback form TODO Add support for making it non-editable

type FeedbackFormStatus

type FeedbackFormStatus int8

FeedbackFormStatus ...

const (
	DraftFeedbackForm FeedbackFormStatus = iota
	PublishedFeedbackForm
)

FeedbackFormStatus ...

func (FeedbackFormStatus) String

func (status FeedbackFormStatus) String() string

String ...

type FeedbackStatus

type FeedbackStatus int8

FeedbackStatus ...

const (
	NewFeedback FeedbackStatus = iota
	InProgressFeedback
	SubmittedFeedback
)

FeedbackStatus ...

func (FeedbackStatus) GetString

func (status FeedbackStatus) GetString() string

GetString ...

type Question

type Question struct {
	gorm.Model
	Text    string       `gorm:"type:text; not null"`
	Type    QuestionType `gorm:"default:0; not null)"`
	Skill   Skill
	SkillID uint         `gorm:"not null"`
	Options fields.JSONB `gorm:"type:jsonb; not null; default:'{}'::jsonb"`
	Weight  int          `gorm:"default:1; not null"`
}

Question represent the questions asked for a skill TODO Add support for versioning and making it non-editable

func (*Question) BeforeSave

func (question *Question) BeforeSave(db *gorm.DB) (err error)

BeforeSave ...

func (Question) GetOptions

func (question Question) GetOptions() (questionOptions map[string]interface{})

GetOptions ...

func (*Question) ValidateQuestionResponse

func (question *Question) ValidateQuestionResponse(questionResponse string) bool

ValidateQuestionResponse validates the question response (default also), against the question options

type QuestionResponse

type QuestionResponse struct {
	gorm.Model
	Feedback              Feedback
	FeedbackID            uint `gorm:"not null"`
	FeedbackFormContent   FeedbackFormContent
	FeedbackFormContentID uint `gorm:"not null"`
	Question              Question
	QuestionID            uint   `gorm:"not null"`
	Response              string `gorm:"type:text"`
	Comment               string `gorm:"type:text"`
}

QuestionResponse represent the response/answer to a question asked for a skill

func (*QuestionResponse) BeforeSave

func (questionResponse *QuestionResponse) BeforeSave(db *gorm.DB) (err error)

BeforeSave ...

type QuestionType

type QuestionType int8

QuestionType ...

const (
	MultiChoiceType QuestionType = iota
	GradingType
	BooleanType
)

QuestionType ...

func (QuestionType) String

func (questionType QuestionType) String() string

String ...

type Schedule

type Schedule struct {
	gorm.Model
	Team          userModels.Team
	TeamID        uint      `gorm:"not null"`
	PeriodValue   uint      `gorm:"not null"`                   // consecutive period units, after which event need to be recreated
	PeriodUnit    string    `gorm:"type:varchar(15); not null"` // Unit of period, eg: year, week, days
	PeriodOffset  uint      `gorm:"default:1; not null"`        // Offset in days between the period end and actual event date
	FeedbackTitle string    `gorm:"type:varchar(255); not null"`
	ExpireInDays  uint      `gorm:"default:10; not null"`
	NextEventAt   time.Time `gorm:"not null"`
	Active        bool      `gorm:"default:true; not null"`
}

Schedule at which feedback events would be created for a team

type Skill

type Skill struct {
	gorm.Model
	Title        string `gorm:"type:varchar(255); not null"`
	DisplayTitle string `gorm:"type:varchar(255)"`
	Description  string `gorm:"type:text"`
	Weight       int    `gorm:"default:1"`
	Questions    []Question
}

Skill represent the skill comprised by category TODO Add support for versioning and making it non-editable

type TeamFeedbackForm

type TeamFeedbackForm struct {
	gorm.Model
	Team           userModels.Team
	TeamID         uint `gorm:"not null"`
	ForRole        userModels.Role
	ForRoleID      uint `gorm:"not null"`
	FeedbackForm   FeedbackForm
	FeedbackFormID uint `gorm:"not null"`
	Active         bool `gorm:"default:false; not null"`
}

TeamFeedbackForm represent the feedback template to be used for a role under a team

Jump to

Keyboard shortcuts

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