Documentation ¶
Index ¶
- Constants
- type Announcement
- type AnnouncementStatus
- type CapacityCounter
- type Class
- func (c *Class) AddSubmission(studentCode string, summary *Submission)
- func (c *Class) CloseSubmission()
- func (c *Class) GetSubmissionByStudentCode(code string) *Submission
- func (c *Class) IntoClassScore(userCode string) *ClassScore
- func (c *Class) IntoSimpleClassScore(userCode string) *SimpleClassScore
- func (c *Class) IsSubmissionClosed() bool
- func (c *Class) Submissions() map[string]*Submission
- type ClassParam
- type ClassScore
- type Course
- func (c *Course) AddClass(class *Class)
- func (c *Course) AddStudent(student *Student)
- func (c *Course) BroadCastAnnouncement(a *Announcement)
- func (c *Course) CalcCourseResultByStudentCode(code string) *CourseResult
- func (c *Course) Classes() []*Class
- func (c *Course) CollectClassScores(userCode string) []*ClassScore
- func (c *Course) CollectSimpleClassScores(userCode string) []*SimpleClassScore
- func (c *Course) CommitReservation(s *Student)
- func (c *Course) GetTotalScoreByStudentCode(code string) int
- func (c *Course) ReserveIfAvailable() ReservationResult
- func (c *Course) RollbackReservation()
- func (c *Course) SetStatusToClosed()
- func (c *Course) SetStatusToInProgress()
- func (c *Course) StartTimer(duration time.Duration)
- func (c *Course) Status() api.CourseStatus
- func (c *Course) Students() map[string]*Student
- func (c *Course) Teacher() *Teacher
- func (c *Course) Wait(ctx context.Context, cancel context.CancelFunc, addCourseFunc func()) <-chan struct{}
- type CourseManager
- func (m *CourseManager) AddNewCourse(course *Course)
- func (m *CourseManager) ExposeCoursesForValidation() map[string]*Course
- func (m *CourseManager) GetCourseByID(id string) (*Course, bool)
- func (m *CourseManager) GetCourseCount() int
- func (m *CourseManager) RemoveRegistrationClosedCourse(c *Course)
- func (m *CourseManager) ReserveCoursesForStudent(student *Student, remainingRegistrationCapacity int) []*Course
- type CourseParam
- type CourseResult
- type GradeRes
- type ReservationResult
- type SearchCourseParam
- type SimpleClassScore
- type SimpleCourseResult
- type Student
- func (s *Student) AddAnnouncement(announcement *Announcement)
- func (s *Student) AddCourse(course *Course)
- func (s *Student) AddFinishCourseCount()
- func (s *Student) AnnouncementCount() int
- func (s *Student) Announcements() []*AnnouncementStatus
- func (s *Student) AnnouncementsMap() map[string]*AnnouncementStatus
- func (s *Student) Courses() []*Course
- func (s *Student) FillTimeslot(course *Course)
- func (s *Student) FinishCourseCount() int64
- func (s *Student) GPA() float64
- func (s *Student) GetAnnouncement(id string) *AnnouncementStatus
- func (s *Student) HasFinishedCourse() bool
- func (s *Student) HasUnreadAnnouncement() bool
- func (s *Student) HasUnreadOrDirtyAnnouncementBefore(announcementID string) bool
- func (s *Student) IsEmptyTimeSlots(dayOfWeek, period int) bool
- func (s *Student) LockSchedule()
- func (s *Student) MarkAnnouncementReadDirty(id string)
- func (s *Student) ReadAnnouncement(id string)
- func (s *Student) RegisteredSchedule() [5][6]*Course
- func (s *Student) RegisteringCount() int
- func (s *Student) ReleaseTimeslot(dayOfWeek, period int)
- func (s *Student) TotalCredit() int
- func (s *Student) UnlockSchedule()
- func (s *Student) WaitExistUnreadAnnouncement(ctx context.Context) <-chan struct{}
- func (s *Student) WaitReadAnnouncement(ctx context.Context, id string) <-chan struct{}
- func (s *Student) WaitReleaseTimeslot(ctx context.Context, cancel context.CancelFunc, registerCourseLimit int) <-chan struct{}
- type Submission
- type Summary
- type Teacher
- type UserAccount
Constants ¶
View Source
const (
// ClassCountPerCourse は科目あたりの講義数 -> used in model/course.go
ClassCountPerCourse = 5
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Announcement ¶
type AnnouncementStatus ¶
type AnnouncementStatus struct { Announcement *Announcement Dirty bool // リクエストを送ったがタイムアウトになってしまったため、webapp側で既読になったかが定かではないことを表す Unread bool }
type CapacityCounter ¶
type CapacityCounter struct {
// contains filtered or unexported fields
}
CapacityCounter はコマごとの、履修可能な学生数をトラックする
func NewCapacityCounter ¶
func NewCapacityCounter() *CapacityCounter
func (*CapacityCounter) Dec ¶
func (c *CapacityCounter) Dec(dayOfWeek, period int)
func (*CapacityCounter) Get ¶
func (c *CapacityCounter) Get(dayOfWeek, period int) int
func (*CapacityCounter) Inc ¶
func (c *CapacityCounter) Inc(dayOfWeek, period int)
func (*CapacityCounter) IncAll ¶
func (c *CapacityCounter) IncAll()
type Class ¶
type Class struct { *ClassParam ID string // contains filtered or unexported fields }
func NewClass ¶
func NewClass(id string, param *ClassParam) *Class
func (*Class) AddSubmission ¶
func (c *Class) AddSubmission(studentCode string, summary *Submission)
func (*Class) CloseSubmission ¶
func (c *Class) CloseSubmission()
func (*Class) GetSubmissionByStudentCode ¶
func (c *Class) GetSubmissionByStudentCode(code string) *Submission
func (*Class) IntoClassScore ¶
func (c *Class) IntoClassScore(userCode string) *ClassScore
func (*Class) IntoSimpleClassScore ¶
func (c *Class) IntoSimpleClassScore(userCode string) *SimpleClassScore
func (*Class) IsSubmissionClosed ¶
func (*Class) Submissions ¶
func (c *Class) Submissions() map[string]*Submission
type ClassParam ¶
type ClassScore ¶
type Course ¶
type Course struct { *CourseParam ID string // contains filtered or unexported fields }
func NewCourse ¶
func NewCourse(param *CourseParam, id string, teacher *Teacher, capacity int, capacityCounter *CapacityCounter) *Course
func (*Course) BroadCastAnnouncement ¶
func (c *Course) BroadCastAnnouncement(a *Announcement)
func (*Course) CalcCourseResultByStudentCode ¶
func (c *Course) CalcCourseResultByStudentCode(code string) *CourseResult
func (*Course) CollectClassScores ¶
func (c *Course) CollectClassScores(userCode string) []*ClassScore
func (*Course) CollectSimpleClassScores ¶
func (c *Course) CollectSimpleClassScores(userCode string) []*SimpleClassScore
func (*Course) CommitReservation ¶
func (*Course) GetTotalScoreByStudentCode ¶
func (*Course) ReserveIfAvailable ¶
func (c *Course) ReserveIfAvailable() ReservationResult
ReserveIfAvailable は履修受付中なら1枠確保する
func (*Course) RollbackReservation ¶
func (c *Course) RollbackReservation()
func (*Course) SetStatusToClosed ¶
func (c *Course) SetStatusToClosed()
func (*Course) SetStatusToInProgress ¶
func (c *Course) SetStatusToInProgress()
func (*Course) StartTimer ¶
func (*Course) Status ¶
func (c *Course) Status() api.CourseStatus
type CourseManager ¶
type CourseManager struct {
// contains filtered or unexported fields
}
CourseManager は科目の履修登録を行う。 空き科目の管理 → 履修登録までが責任範囲。
func NewCourseManager ¶
func NewCourseManager(cc *CapacityCounter) *CourseManager
func (*CourseManager) AddNewCourse ¶
func (m *CourseManager) AddNewCourse(course *Course)
func (*CourseManager) ExposeCoursesForValidation ¶
func (m *CourseManager) ExposeCoursesForValidation() map[string]*Course
func (*CourseManager) GetCourseByID ¶
func (m *CourseManager) GetCourseByID(id string) (*Course, bool)
func (*CourseManager) GetCourseCount ¶
func (m *CourseManager) GetCourseCount() int
func (*CourseManager) RemoveRegistrationClosedCourse ¶
func (m *CourseManager) RemoveRegistrationClosedCourse(c *Course)
func (*CourseManager) ReserveCoursesForStudent ¶
func (m *CourseManager) ReserveCoursesForStudent(student *Student, remainingRegistrationCapacity int) []*Course
ReserveCoursesForStudent は学生を受け取って、キュー内の科目に仮登録を行う
type CourseParam ¶
type CourseResult ¶
type GradeRes ¶
type GradeRes struct { Summary Summary CourseResults map[string]*CourseResult }
func NewGradeRes ¶
func NewGradeRes(summary Summary, courseResults map[string]*CourseResult) GradeRes
type ReservationResult ¶
type ReservationResult int
const ( Succeeded ReservationResult = iota NotAvailable )
type SearchCourseParam ¶
type SearchCourseParam struct { Type string Credit int Teacher string Period int DayOfWeek int Keywords []string Status string }
func NewCourseParam ¶
func NewCourseParam() *SearchCourseParam
func (*SearchCourseParam) GetParamString ¶
func (p *SearchCourseParam) GetParamString() string
type SimpleClassScore ¶
type SimpleCourseResult ¶
type SimpleCourseResult struct { Name string // course name Code string // course code SimpleClassScores []*SimpleClassScore }
CourseResultのうち計算しなくていいやつ
func NewSimpleCourseResult ¶
func NewSimpleCourseResult(name, code string, classScores []*SimpleClassScore) *SimpleCourseResult
type Student ¶
type Student struct { *UserAccount Agent *agent.Agent // contains filtered or unexported fields }
func NewStudent ¶
func NewStudent(userData *UserAccount, baseURL *url.URL) *Student
func (*Student) AddAnnouncement ¶
func (s *Student) AddAnnouncement(announcement *Announcement)
func (*Student) AddFinishCourseCount ¶
func (s *Student) AddFinishCourseCount()
func (*Student) AnnouncementCount ¶
func (*Student) Announcements ¶
func (s *Student) Announcements() []*AnnouncementStatus
func (*Student) AnnouncementsMap ¶
func (s *Student) AnnouncementsMap() map[string]*AnnouncementStatus
func (*Student) FillTimeslot ¶
FillTimeslot で登録処理を行う場合は別途scheduleMutexでLockすること
func (*Student) FinishCourseCount ¶
func (*Student) GetAnnouncement ¶
func (s *Student) GetAnnouncement(id string) *AnnouncementStatus
func (*Student) HasFinishedCourse ¶
func (*Student) HasUnreadAnnouncement ¶
func (*Student) HasUnreadOrDirtyAnnouncementBefore ¶
func (*Student) IsEmptyTimeSlots ¶
IsEmptyTimeSlots でコマを参照する場合は別途scheduleMutexで(R)Lockすること
func (*Student) LockSchedule ¶
func (s *Student) LockSchedule()
func (*Student) MarkAnnouncementReadDirty ¶
func (*Student) ReadAnnouncement ¶
func (*Student) RegisteredSchedule ¶
func (*Student) RegisteringCount ¶
func (*Student) ReleaseTimeslot ¶
func (*Student) TotalCredit ¶
func (*Student) UnlockSchedule ¶
func (s *Student) UnlockSchedule()
func (*Student) WaitExistUnreadAnnouncement ¶
WaitExistUnreadAnnouncement は未読おしらせが発生するまでwaitする
func (*Student) WaitReadAnnouncement ¶
func (*Student) WaitReleaseTimeslot ¶
type Submission ¶
func NewSubmission ¶
func NewSubmission(title string, data []byte) *Submission
func (*Submission) Score ¶
func (s *Submission) Score() *int
func (*Submission) SetScore ¶
func (s *Submission) SetScore(score int)
type Teacher ¶
type Teacher struct { *UserAccount Agent *agent.Agent IsLoggedIn bool // contains filtered or unexported fields }
func NewTeacher ¶
func NewTeacher(userData *UserAccount, baseURL *url.URL) *Teacher
Click to show internal directories.
Click to hide internal directories.