Documentation ¶
Index ¶
- Constants
- Variables
- type AutopilotService
- type AutopilotSettings
- type FillError
- type FillSettings
- type InAddToCalendar
- type InAssignTask
- type InClearCalendar
- type InCreateShift
- type InCreateTicket
- type InDisqualify
- type InJoinRotation
- type InQualify
- type InRunAutopilot
- type InTransitionTask
- type Level
- type Need
- type Needs
- func (needs Needs) AsArray() []Need
- func (needs *Needs) CheckLimits(user *User) (adjusted, modified, violated *Needs)
- func (require *Needs) CheckRequired(user *User) (adjusted *Needs)
- func (needs Needs) Clone() *Needs
- func (needs Needs) Get(id types.ID) Need
- func (needs Needs) GetCountForSkillLevel(skillLevel SkillLevel) int64
- func (needs *Needs) IsEmpty() bool
- func (needs Needs) Markdown() md.MD
- func (needs Needs) MarkdownSkillLevels() string
- func (needs *Needs) Set(need Need)
- func (needs *Needs) SetCountForSkillLevel(skillLevel SkillLevel, count int64)
- func (needs Needs) String() string
- func (needs Needs) Unmet(users *Users) *Needs
- type OutAssignTask
- type OutCalendar
- type OutCreateTask
- type OutJoinRotation
- type OutQualify
- type OutRunAutopilot
- type OutTransitionTask
- type PluginAPI
- type Rotation
- func (r *Rotation) FindUsers(mattermostUserIDs *types.IDSet) []*User
- func (r *Rotation) Init()
- func (r *Rotation) Markdown() md.MD
- func (r *Rotation) MarkdownBullets() md.MD
- func (r *Rotation) Name() string
- func (r *Rotation) String() string
- func (rotation *Rotation) WithMattermostUserIDs(pool *Users) *Rotation
- type RotationService
- type SL
- type Service
- type SkillLevel
- type SkillService
- type Task
- type TaskFiller
- type TaskService
- type TaskSettings
- type Tasks
- type Unavailable
- type User
- func (user *User) AddUnavailable(uu ...*Unavailable) []*Unavailable
- func (user *User) ClearUnavailable(matchInterval types.Interval, matchRotationID, matchTaskID types.ID) []*Unavailable
- func (user *User) FindUnavailable(matchInterval types.Interval, matchRotationID, matchTaskID types.ID) []*Unavailable
- func (user *User) GetID() types.ID
- func (user *User) Markdown() md.MD
- func (user *User) MarkdownInterval(i types.Interval) md.MD
- func (user *User) MarkdownSkills() md.MD
- func (user *User) MarkdownUnavailable(u *Unavailable) md.MD
- func (user *User) MarkdownWithSkills() md.MD
- func (user User) MattermostUsername() string
- func (user *User) ScanUnavailable(matchInterval types.Interval, matchRotationID, matchTaskID types.ID, ...)
- func (user *User) String() string
- func (user *User) Time(t types.Time) types.Time
- func (user *User) WithLastServed(rotationID types.ID, finishTime types.Time) *User
- func (user *User) WithSkills(skillLevels *types.IntSet) *User
- type UserService
- type Users
- func (users Users) AsArray() []*User
- func (users Users) Clone() *Users
- func (users Users) Get(id types.ID) *User
- func (users *Users) IsEmpty() bool
- func (users Users) Join(other *Users) *Users
- func (users Users) Markdown() md.MD
- func (users Users) MarkdownWithSkills() string
- func (users Users) String() string
- func (users Users) TestArray() []User
Constants ¶
View Source
const ( ReasonTask = "task" ReasonGrace = "grace" ReasonPersonal = "personal" )
View Source
const ( AnyLevel = Level(iota) BeginnerLevel IntermediateLevel AdvancedLevel ExpertLevel )
View Source
const ( AdvancedLevelName = "advanced" AdvancedLevelSymbol = "◈" AnyLevelName = "any" AnyLevelSymbol = "*" BeginnerLevelName = "beginner" BeginnerLevelSymbol = "◉" ExpertLevelName = "expert" ExpertLevelSymbol = "◈◈" IntermediateLevelName = "intermediate" IntermediateLevelSymbol = "▣" )
View Source
const ( TaskTypeTicket = types.ID("ticket") TaskTypeShift = types.ID("shift") )
View Source
const ( KeyRotation = "rotation_" KeyRotationTasks = "rotation_tasks_" KeyTask = "task_" KeyUser = "user_" KeyKnownSkills = "known_skills" KeyActiveRotations = "active_rotations" )
View Source
const ( // New tasks that have been submitted are Pending. There are no restrictions // on assigning, filling, or un-assigning users to pending tasks. // No DMs are sent to users added to or removed from these tasks. TaskStatePending = types.ID("pending") // Scheduled tasks are normally verified to have met the requirements and // constraints. Assigned users receive a message when a task is scheduled. A // scheduled task may no longer be filled, but users can still be assigned // and unassigned manually, with DM notifications. Users added to a // scheduled task get task-related unavailability events added to their // calendars. TaskStateScheduled = types.ID("scheduled") // An in-progress task. Users can be assigned, but not filled (nor unassigned?). TaskStateStarted = types.ID("started") // Finished tasks are archived, and are not yet used. TaskStateFinished = types.ID("finished") )
Variables ¶
View Source
var AnySkill = types.ID("any")
View Source
var AnySkillLevel = NewSkillLevel(AnySkill, AnyLevel)
View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrFillInsufficient = errors.New("insufficient")
View Source
var ErrFillLimit = errors.New("limit violated")
View Source
var ErrMultipleResults = errors.New("multiple results found")
View Source
var ErrWrongState = errors.New("operation is not allowed in this state")
View Source
var NeedOneAnyLevel = NewNeed(1, AnySkillLevel)
Functions ¶
This section is empty.
Types ¶
type AutopilotService ¶
type AutopilotService interface {
RunAutopilot(in *InRunAutopilot) (*OutRunAutopilot, error)
}
type AutopilotSettings ¶
type AutopilotSettings struct { Create bool `json:",omitempty"` CreatePrior time.Duration `json:",omitempty"` Schedule bool `json:",omitempty"` SchedulePrior time.Duration `json:",omitempty"` StartFinish bool `json:",omitempty"` RemindStart bool `json:",omitempty"` RemindStartPrior time.Duration `json:",omitempty"` RemindFinish bool `json:",omitempty"` RemindFinishPrior time.Duration `json:",omitempty"` }
type FillSettings ¶
type FillSettings struct { // Beginning marks the time when scheduling starts Beginning types.Time // Period specifies the recurrence of shifts, but is also used to calculate // the user weights when filling tasks. Period types.Period // Seed is a stable seed to use for rand. Seed int64 `json:",omitempty"` // Fuzz is the number of periods that gets added to the default doubling // duration when calculating user weights. Fuzz int64 `json:",omitempty"` }
type InAddToCalendar ¶
type InAssignTask ¶
type InClearCalendar ¶
type InCreateTicket ¶
type InDisqualify ¶
type InJoinRotation ¶
type InQualify ¶
type InQualify struct { MattermostUserIDs *types.IDSet SkillLevels []SkillLevel }
type InTransitionTask ¶
type Need ¶
func NewNeed ¶
func NewNeed(count int64, skillLevel SkillLevel) Need
func (Need) SkillLevel ¶
func (need Need) SkillLevel() SkillLevel
type Needs ¶
Needs is a map of SkillLevel to an int64 headcount needed.
func (*Needs) CheckLimits ¶
func (*Needs) CheckRequired ¶
func (Needs) GetCountForSkillLevel ¶
func (needs Needs) GetCountForSkillLevel(skillLevel SkillLevel) int64
func (Needs) MarkdownSkillLevels ¶
func (*Needs) SetCountForSkillLevel ¶
func (needs *Needs) SetCountForSkillLevel(skillLevel SkillLevel, count int64)
type OutCalendar ¶
type OutCreateTask ¶
type OutJoinRotation ¶
type OutQualify ¶
type OutRunAutopilot ¶
type Rotation ¶
type Rotation struct { PluginVersion string RotationID types.ID IsArchived bool FillerType types.ID TaskType types.ID MattermostUserIDs *types.IDSet `json:",omitempty"` TaskIDs *types.IDSet `json:",omitempty"` TaskSettings TaskSettings `json:",omitempty"` FillSettings FillSettings `json:",omitempty"` AutopilotSettings AutopilotSettings `json:",omitempty"` Users *Users `json:"-"` Tasks *Tasks `json:"-"` // contains filtered or unexported fields }
func NewRotation ¶
func NewRotation() *Rotation
func (*Rotation) MarkdownBullets ¶
func (*Rotation) WithMattermostUserIDs ¶
type RotationService ¶
type RotationService interface { AddRotation(*Rotation) error ArchiveRotation(rotationID types.ID) (*Rotation, error) DebugDeleteRotation(rotationID types.ID) error LoadActiveRotations() (*types.IDSet, error) LoadRotation(rotationID types.ID) (*Rotation, error) MakeRotation(rotationName string) (*Rotation, error) ResolveRotationName(string) (types.ID, error) UpdateRotation(rotationID types.ID, updatef func(*Rotation) error) (*Rotation, error) }
type SL ¶
type SL interface { RotationService SkillService UserService TaskService AutopilotService PluginAPI bot.Logger ActingUser() (*User, error) Config() *config.Config LoadUsers(mattermostUserIDs *types.IDSet) (*Users, error) LoadMattermostUserByUsername(username string) (*User, error) }
type Service ¶
type SkillLevel ¶
func NewSkillLevel ¶
func NewSkillLevel(s types.ID, l Level) SkillLevel
func ParseSkillLevel ¶
func ParseSkillLevel(in types.ID) SkillLevel
func (SkillLevel) AsID ¶
func (skillLevel SkillLevel) AsID() types.ID
func (SkillLevel) GetID ¶
func (skillLevel SkillLevel) GetID() types.ID
func (*SkillLevel) Set ¶
func (skillLevel *SkillLevel) Set(in string) error
func (SkillLevel) String ¶
func (skillLevel SkillLevel) String() string
func (SkillLevel) Type ¶
func (skillLevel SkillLevel) Type() string
type SkillService ¶
type Task ¶
type Task struct { // TODO set PluginID on save PluginVersion string TaskID types.ID RotationID types.ID State types.ID ActualFinish types.Time `json:",omitempty"` ActualStart types.Time `json:",omitempty"` AutopilotRemindedFinish bool `json:",omitempty"` AutopilotRemindedStart bool `json:",omitempty"` Description string `json:",omitempty"` ExpectedDuration time.Duration `json:",omitempty"` ExpectedStart types.Time `json:",omitempty"` Grace time.Duration `json:",omitempty"` Limit *Needs `json:",omitempty"` MattermostUserIDs *types.IDSet `json:",omitempty"` Require *Needs `json:",omitempty"` Summary string `json:",omitempty"` Users *Users `json:"-"` }
func (*Task) NewUnavailable ¶
func (t *Task) NewUnavailable() []*Unavailable
type TaskFiller ¶
type TaskService ¶
type TaskService interface { AssignTask(InAssignTask) (*OutAssignTask, error) UnassignTask(InAssignTask) (*OutAssignTask, error) FillTask(InAssignTask) (*OutAssignTask, error) LoadTask(types.ID) (*Task, error) TransitionTask(params InTransitionTask) (*OutTransitionTask, error) CreateTicket(InCreateTicket) (*OutCreateTask, error) CreateShift(InCreateShift) (*OutCreateTask, error) }
type TaskSettings ¶
type Unavailable ¶
type Unavailable struct {}
func NewUnavailable ¶
func NewUnavailable(reason string, interval types.Interval) *Unavailable
type User ¶
type User struct { PluginVersion string `json:",omitempty"` MattermostUserID types.ID SkillLevels *types.IntSet `json:",omitempty"` // skill (id) -> level LastServed *types.IntSet `json:",omitempty"` // Last time completed a task, rotationID -> Unix time. Calendar []*Unavailable `json:",omitempty"` // Sorted by start date of the events. // contains filtered or unexported fields }
func (*User) AddUnavailable ¶
func (user *User) AddUnavailable(uu ...*Unavailable) []*Unavailable
func (*User) ClearUnavailable ¶
func (*User) FindUnavailable ¶
func (*User) MarkdownSkills ¶
func (*User) MarkdownUnavailable ¶
func (user *User) MarkdownUnavailable(u *Unavailable) md.MD
func (*User) MarkdownWithSkills ¶
func (User) MattermostUsername ¶
func (*User) ScanUnavailable ¶
func (*User) WithLastServed ¶
type UserService ¶
type UserService interface { AddToCalendar(InAddToCalendar) (*OutCalendar, error) ClearCalendar(InClearCalendar) (*OutCalendar, error) Disqualify(InDisqualify) (*OutQualify, error) JoinRotation(InJoinRotation) (*OutJoinRotation, error) LeaveRotation(InJoinRotation) (*OutJoinRotation, error) Qualify(InQualify) (*OutQualify, error) }
type Users ¶
func (Users) MarkdownWithSkills ¶
Source Files ¶
- api_autopilot.go
- api_task_assign.go
- api_task_create.go
- api_task_fill.go
- api_task_transition.go
- api_task_unassign.go
- api_user_add_to_calendar.go
- api_user_clear_calendar.go
- api_user_disqualify.go
- api_user_join_rotation.go
- api_user_leave_rotation.go
- api_user_qualify.go
- calendar.go
- fill.go
- level.go
- need.go
- needs.go
- rotation.go
- skill_level.go
- sl.go
- sl_autopilot.go
- sl_rotation.go
- sl_service.go
- sl_setup.go
- sl_skills.go
- sl_task.go
- sl_user.go
- store.go
- task.go
- tasks.go
- user.go
- user_messages.go
- users.go
Directories ¶
Path | Synopsis |
---|---|
filler
|
|
Package mock_sl is a generated GoMock package.
|
Package mock_sl is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.