Documentation ¶
Index ¶
- Constants
- Variables
- func InMajor(major string) func(Internship) bool
- func StudentInMajor(major string) func(Student) bool
- func Tutoring(tut string) func(Internship) bool
- type Alumni
- type Anonymiser
- type Category
- type Company
- type Convention
- type Defense
- type DefenseSession
- type Internship
- type Internships
- type Internshipser
- type Person
- type Question
- type ReportHeader
- type Role
- type Session
- type Student
- type StudentReports
- type Students
- type Survey
- type SurveyHeader
- type User
Constants ¶
const ( StudentLevel int = iota TutorLevel MajorLevel HeadLevel AdminLevel RootLevel STUDENT Role = "student" TUTOR Role = "tutor" ROOT Role = "root" //DateLayout indicates the date format DateLayout = "02/01/2006 15:04" )
The different level of Roles
Variables ¶
var ( //ErrUnknownStudent declares the student is unknown ErrUnknownStudent = errors.New("Unknown student") //ErrUnknownConvention declares the convention is unknown ErrUnknownConvention = errors.New("No convention associated to this student") //ErrStudentExists declares the student already exists ErrStudentExists = errors.New("Student already exists") //ErrReportExists declares the report already exists ErrReportExists = errors.New("Report already exists") //ErrUnknownReport declares the report does not exist ErrUnknownReport = errors.New("Unknown report or student") //ErrInvalidGrade declares the grade is not between in 0 and 20 ErrInvalidGrade = errors.New("The grade must be between 0 and 20 (inclusive)") //ErrReportConflict declares a report has not been uploaded ErrReportConflict = errors.New("The report has not been uploaded") //ErrInternshipExists declares the internship already exists ErrInternshipExists = errors.New("Internship already exists") //ErrUnknownInternship declares the internship does not exists ErrUnknownInternship = errors.New("Unknown internship") //ErrUserExists declares the user already exists ErrUserExists = errors.New("User already exists") //ErrUnknownUser declares the user is unknown ErrUnknownUser = errors.New("The email does not match a registered user") //ErrUserTutoring declares the user cannot be removed as it is tutoring students ErrUserTutoring = errors.New("The user is tutoring students") //ErrCredentials declares invalid credentials ErrCredentials = errors.New("Incorrect password") //ErrPasswordTooShort declares the stated password is too short ErrPasswordTooShort = errors.New("Password too short (8 chars. min)") //ErrNoPendingRequests declares there is no password renewal request ErrNoPendingRequests = errors.New("No pending reset request. You might use a bad or an expired reset token.") //ErrInvalidPeriod declared the internship period is incorrect ErrInvalidPeriod = errors.New("invalid internship period") //ErrConventionExists declares a convention for the student already exists ErrConventionExists = errors.New("convention already scanned") //ErrInvalidMajor declares the declared major is not supported ErrInvalidMajor = errors.New("Unknown major") //ErrInvalidPromotion declares the promotion is not supported ErrInvalidPromotion = errors.New("Unknown promotion") //ErrDeadlinePassed declares the deadline for a report passed ErrDeadlinePassed = errors.New("Deadline passed") //ErrGradedReport declares the report is already graded ErrGradedReport = errors.New("Report already graded") //ErrSessionExpired declares an expired session ErrSessionExpired = errors.New("Session expired") //ErrInvalidToken declares an invalid session token ErrInvalidToken = errors.New("Invalid session") //ErrUnknownSurvey declares the survey does not exist ErrUnknownSurvey = errors.New("Unknown survey or student") //ErrSurveyUploaded declares the survey has already been uploaded ErrSurveyUploaded = errors.New("Survey already fullfilled") //ErrInvalidSurvey declares the answers are invalid ErrInvalidSurvey = errors.New("Invalid answers") //ErrUnknownAlumni declares there is no alumni information for the students ErrUnknownAlumni = errors.New("No informations for future alumni") //ErrInvalidAlumniEmail declares the email cannot be used for alumni ErrInvalidAlumniEmail = errors.New("Invalid email. It must not be served by polytech' or unice") //ErrInvalidEmail declares the email is invalid ErrInvalidEmail = errors.New("Invalid email") //ErrUnknownDefense declares the defense is unknown ErrUnknownDefense = errors.New("Unknown defense") //ErrDefenseSessionConflit declares a session that is in conflict with another ErrDefenseSessionConflit = errors.New("There is already a session for that slot") ErrDefenseExists = errors.New("The defense is already planned") ErrDefenseConflict = errors.New("A defense is already planned for that slot") ErrDefenseJuryConflict = errors.New("The teacher is already in a jury for that period") )
Functions ¶
func InMajor ¶
func InMajor(major string) func(Internship) bool
InMajor is a filter that keep only the internships in the given major
func StudentInMajor ¶
StudentInMajor is a filter that keep only the students in the given major
func Tutoring ¶
func Tutoring(tut string) func(Internship) bool
Tutoring is a filter that keep only the internships tutored by the given user
Types ¶
type Anonymiser ¶
type Anonymiser interface {
Anonymise()
}
type Company ¶
type Company struct { //The company name Name string //The company website WWW string //The job title Title string }
Company stores meaningful information for a company hosting a student.
type Convention ¶
type Convention struct { Creation time.Time Student Student Tutor User Supervisor Person Company Company Begin time.Time End time.Time //Ignore this convention (don't managed by wints if true) Skip bool Valid bool ForeignCountry bool Lab bool Gratification int }
Convention declares a student convention
type Defense ¶
type Defense struct { Room string SessionId string Public bool Local bool Grade int Time time.Time Student Student Company Company }
Defense depicts the defense of a student
type DefenseSession ¶
DefenseSession groups all the defenses that occurs during a session
func (DefenseSession) Anonymise ¶
func (s DefenseSession) Anonymise()
func (DefenseSession) InJury ¶
func (s DefenseSession) InJury(em string) bool
InJury check if a user is a part of a jury
type Internship ¶
type Internship struct { Convention Convention //The headers for each Reports []ReportHeader //The surveys Surveys []SurveyHeader //Defense Defense Defense }
Internship is the core type to specify required data related to an internship
func (*Internship) Anonymise ¶
func (i *Internship) Anonymise()
Anonymise the convention, the reports and the surveys
type Internships ¶
type Internships []Internship
Internships aliases slices of internship to exhibit filtering methods
func (Internships) Filter ¶
func (ss Internships) Filter(filters ...func(Internship) bool) Internships
Filter returns the internships that pass the given filters
type Internshipser ¶
type Internshipser interface {
Internships() (Internships, error)
}
Internshipser is a basic interface to browse internships
type Person ¶
Person just gathers contact information for someone.
func (*Person) Anonymise ¶
func (p *Person) Anonymise()
Anonymise the person by removing any personal information
type ReportHeader ¶
type ReportHeader struct { Kind string //The report deadline Deadline time.Time Delivery *time.Time `,json:"omitempty"` Reviewed *time.Time `,json:"omitempty"` Grade int //The tutor comment Comment string Private bool ToGrade bool }
ReportHeader provides the metadata associated to a student report
func (*ReportHeader) Graded ¶
func (m *ReportHeader) Graded() bool
Graded indicates if a report has been graded
func (*ReportHeader) In ¶
func (m *ReportHeader) In() bool
In indicates if a report has been uploaded
type Role ¶
type Role string
Role aims at giving the possible level of Role for a user.
type Student ¶
type Student struct { User User Promotion string Major string Alumni *Alumni `,json:"omitempty"` //Skip indicates we don't care about this student. Might left the school for example Skip bool Male bool }
Student denotes a student that as a promotion, a major.
type StudentReports ¶
type StudentReports struct { Student Student Reports []ReportHeader }
StudentReports aggregate the reports of a given student
type Students ¶
type Students []Student
Students aliases slices of student to exhibit filtering methods
type SurveyHeader ¶
type SurveyHeader struct { Kind string //Invitation the moment where the request must be sent Invitation time.Time //LastInvitation the moment where the last request has been emitted LastInvitation time.Time //The deadline where the survey shall be uploaded Deadline time.Time //The moment the survey was committed Delivery *time.Time `,json:"omitempty"` //The token to access in write mode Token string //Survey content Cnt map[string]string }
SurveyHeader provides the metadata associated to a student survey