use switch
This commit is contained in:
parent
db17e3e28e
commit
060d222941
@ -175,16 +175,17 @@ func (a *Agent) CreateSchedTask(st SchedTask) (bool, error) {
|
|||||||
var tasktrigger taskmaster.TaskTrigger
|
var tasktrigger taskmaster.TaskTrigger
|
||||||
|
|
||||||
var now = time.Now()
|
var now = time.Now()
|
||||||
if st.Trigger == "manual" {
|
switch st.Trigger {
|
||||||
|
case "manual":
|
||||||
tasktrigger = taskmaster.TaskTrigger{
|
tasktrigger = taskmaster.TaskTrigger{
|
||||||
Enabled: st.Enabled,
|
Enabled: st.Enabled,
|
||||||
StartBoundary: now,
|
StartBoundary: now,
|
||||||
}
|
}
|
||||||
} else if st.Trigger == "onboarding" {
|
case "onboarding":
|
||||||
tasktrigger = taskmaster.TaskTrigger{
|
tasktrigger = taskmaster.TaskTrigger{
|
||||||
Enabled: st.Enabled,
|
Enabled: st.Enabled,
|
||||||
}
|
}
|
||||||
} else {
|
default:
|
||||||
tasktrigger = taskmaster.TaskTrigger{
|
tasktrigger = taskmaster.TaskTrigger{
|
||||||
Enabled: st.Enabled,
|
Enabled: st.Enabled,
|
||||||
StartBoundary: time.Date(st.StartYear, st.StartMonth, st.StartDay, st.StartHour, st.StartMinute, 0, 0, now.Location()),
|
StartBoundary: time.Date(st.StartYear, st.StartMonth, st.StartDay, st.StartHour, st.StartMinute, 0, 0, now.Location()),
|
||||||
@ -209,11 +210,10 @@ func (a *Agent) CreateSchedTask(st SchedTask) (bool, error) {
|
|||||||
TaskTrigger: tasktrigger,
|
TaskTrigger: tasktrigger,
|
||||||
RandomDelay: st.RandomDelay,
|
RandomDelay: st.RandomDelay,
|
||||||
}
|
}
|
||||||
|
|
||||||
case "onboarding":
|
case "onboarding":
|
||||||
trigger = taskmaster.RegistrationTrigger{
|
trigger = taskmaster.RegistrationTrigger{
|
||||||
TaskTrigger: tasktrigger,
|
TaskTrigger: tasktrigger,
|
||||||
Delay: st.RandomDelay,
|
Delay: st.RandomDelay,
|
||||||
}
|
}
|
||||||
|
|
||||||
case "daily":
|
case "daily":
|
||||||
|
Loading…
Reference in New Issue
Block a user