use switch

This commit is contained in:
wh1te909 2023-12-01 11:27:28 -08:00
parent db17e3e28e
commit 060d222941

View File

@ -175,16 +175,17 @@ func (a *Agent) CreateSchedTask(st SchedTask) (bool, error) {
var tasktrigger taskmaster.TaskTrigger
var now = time.Now()
if st.Trigger == "manual" {
switch st.Trigger {
case "manual":
tasktrigger = taskmaster.TaskTrigger{
Enabled: st.Enabled,
StartBoundary: now,
}
} else if st.Trigger == "onboarding" {
case "onboarding":
tasktrigger = taskmaster.TaskTrigger{
Enabled: st.Enabled,
Enabled: st.Enabled,
}
} else {
default:
tasktrigger = taskmaster.TaskTrigger{
Enabled: st.Enabled,
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,
RandomDelay: st.RandomDelay,
}
case "onboarding":
trigger = taskmaster.RegistrationTrigger{
TaskTrigger: tasktrigger,
Delay: st.RandomDelay,
Delay: st.RandomDelay,
}
case "daily":