Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisJasso committed Apr 18, 2024
1 parent ee59405 commit ecf0f23
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pager/opsgenie.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ func (p *Opsgenie) Kind() string {
}

func (o *Opsgenie) LoadSchedules(ctx context.Context) error {
expandListRequest := true
resp, err := o.scheduleClient.List(ctx, &schedule.ListRequest{
// this is the cleanest way I found of making a *bool. Happy to replace it with anything more readable.
Expand: func() *bool { b := true; return &b }(),
Expand: &expandListRequest,
})

if err != nil {
Expand Down Expand Up @@ -191,8 +191,8 @@ func (o *Opsgenie) saveRotationToDB(ctx context.Context, s schedule.Schedule, r
switch r.TimeRestriction.Type {
case og.WeekdayAndTimeOfDay:
for i, tr := range r.TimeRestriction.RestrictionList {
startTime, _ := time.Parse(time.TimeOnly, fmt.Sprintf("%d:%02d:00", *tr.StartHour, *tr.StartMin))
endTime, _ := time.Parse(time.TimeOnly, fmt.Sprintf("%d:%02d:00", *tr.EndHour, *tr.EndMin))
startTime := time.Date(0, time.January, 1, int(*tr.StartHour), int(*tr.StartMin), 0, 0, time.UTC)
endTime := time.Date(0, time.January, 1, int(*tr.EndHour), int(*tr.EndMin), 0, 0, time.UTC)

ogsRestrictionsParams := store.InsertExtScheduleRestrictionParams{
ScheduleID: ogsParams.ID,
Expand All @@ -210,8 +210,8 @@ func (o *Opsgenie) saveRotationToDB(ctx context.Context, s schedule.Schedule, r
for i := range 7 {
tr := r.TimeRestriction.Restriction
startDayStr := strings.ToLower(time.Weekday(i).String())
startTime, _ := time.Parse(time.TimeOnly, fmt.Sprintf("%d:%02d:00", *tr.StartHour, *tr.StartMin))
endTime, _ := time.Parse(time.TimeOnly, fmt.Sprintf("%d:%02d:00", *tr.EndHour, *tr.EndMin))
startTime := time.Date(0, time.January, 1, int(*tr.StartHour), int(*tr.StartMin), 0, 0, time.UTC)
endTime := time.Date(0, time.January, 1, int(*tr.EndHour), int(*tr.EndMin), 0, 0, time.UTC)
var endDayStr string
if endTime.Before(startTime) {
day := (i + 1) % 7
Expand Down

0 comments on commit ecf0f23

Please sign in to comment.