From 8d8b75a5db9a60f047596226999872ffea8cd1e3 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Mon, 26 Jun 2023 12:29:37 -0500 Subject: [PATCH] change config to fields and improve comment --- database/schedule/update.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/database/schedule/update.go b/database/schedule/update.go index c60ae7568..1d4f00e1e 100644 --- a/database/schedule/update.go +++ b/database/schedule/update.go @@ -2,7 +2,6 @@ // // Use of this source code is governed by the LICENSE file in this repository. -//nolint:dupl // ignore similar code with create.go package schedule import ( @@ -13,7 +12,7 @@ import ( ) // UpdateSchedule updates an existing schedule in the database. -func (e *engine) UpdateSchedule(s *library.Schedule, config bool) error { +func (e *engine) UpdateSchedule(s *library.Schedule, fields bool) error { e.logger.WithFields(logrus.Fields{ "schedule": s.GetName(), }).Tracef("updating schedule %s in the database", s.GetName()) @@ -27,8 +26,8 @@ func (e *engine) UpdateSchedule(s *library.Schedule, config bool) error { return err } - // if update is just setting the scheduled_at, then ignore updating other fields - if config { + // If "fields" is true, update entire record; otherwise, just update scheduled_at (part of processSchedule) + if fields { err = e.client.Table(constants.TableSchedule).Save(schedule).Error } else { err = e.client.Table(constants.TableSchedule).Model(schedule).UpdateColumn("scheduled_at", s.GetScheduledAt()).Error