Skip to content

Commit

Permalink
refactor: name variables in channels list
Browse files Browse the repository at this point in the history
  • Loading branch information
kemenaran committed Apr 14, 2022
1 parent 3d1dede commit 77a639e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,28 @@ func (p *Plugin) categorizeOccurrences(reminders []Reminder) (
t := occurrence.Occurrence
s := occurrence.Snoozed

if !strings.HasPrefix(reminder.Target, "~") &&
reminder.Completed == p.emptyTime &&
((occurrence.Repeat == "" && t.After(time.Now().UTC())) ||
isChannelReminder := strings.HasPrefix(reminder.Target, "~")
isCompleted := reminder.Completed != p.emptyTime
isPast := t.Before(time.Now().UTC())
isFuture := t.After(time.Now().UTC())

if !isChannelReminder &&
!isCompleted &&
((occurrence.Repeat == "" && isFuture) ||
(s != p.emptyTime && s.After(time.Now().UTC()))) {
upcomingOccurrences = append(upcomingOccurrences, occurrence)
} else if !strings.HasPrefix(reminder.Target, "~") &&
occurrence.Repeat != "" && t.After(time.Now().UTC()) {
} else if !isChannelReminder &&
occurrence.Repeat != "" && isFuture {
recurringOccurrences = append(recurringOccurrences, occurrence)
} else if reminder.Completed == p.emptyTime &&
t.Before(time.Now().UTC()) &&
} else if !isCompleted &&
isPast &&
(s == p.emptyTime || s.Before(time.Now().UTC())) {
pastOccurrences = append(pastOccurrences, occurrence)
} else if strings.HasPrefix(reminder.Target, "~") &&
reminder.Completed == p.emptyTime &&
t.After(time.Now().UTC()) {
} else if isChannelReminder &&
!isCompleted &&
isFuture {
channelOccurrences = append(channelOccurrences, occurrence)
} else if reminder.Completed != p.emptyTime {
} else if isCompleted {
//p.API.LogInfo("completed reminder: " + fmt.Sprintf("%v", reminder))
} else {
//p.API.LogInfo("unknown reminder: " + fmt.Sprintf("%v", reminder))
Expand Down

0 comments on commit 77a639e

Please sign in to comment.