diff --git a/server/list.go b/server/list.go index 717c50d..e98c834 100755 --- a/server/list.go +++ b/server/list.go @@ -140,32 +140,30 @@ func (p *Plugin) categorizeOccurrences(reminders []Reminder) ( occurrences := reminder.Occurrences if len(occurrences) > 0 { - for _, occurrence := range occurrences { - t := occurrence.Occurrence - s := occurrence.Snoozed - - if !strings.HasPrefix(reminder.Target, "~") && - reminder.Completed == p.emptyTime && - ((occurrence.Repeat == "" && t.After(time.Now().UTC())) || - (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()) { - recurringOccurrences = append(recurringOccurrences, occurrence) - } else if reminder.Completed == p.emptyTime && - t.Before(time.Now().UTC()) && - (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()) { - channelOccurrences = append(channelOccurrences, occurrence) - } else if reminder.Completed != p.emptyTime { - //p.API.LogInfo("completed reminder: " + fmt.Sprintf("%v", reminder)) - } else { - //p.API.LogInfo("unknown reminder: " + fmt.Sprintf("%v", reminder)) - } - + occurrence := occurrences[0] + t := occurrence.Occurrence + s := occurrence.Snoozed + + if !strings.HasPrefix(reminder.Target, "~") && + reminder.Completed == p.emptyTime && + ((occurrence.Repeat == "" && t.After(time.Now().UTC())) || + (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()) { + recurringOccurrences = append(recurringOccurrences, occurrence) + } else if reminder.Completed == p.emptyTime && + t.Before(time.Now().UTC()) && + (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()) { + channelOccurrences = append(channelOccurrences, occurrence) + } else if reminder.Completed != p.emptyTime { + //p.API.LogInfo("completed reminder: " + fmt.Sprintf("%v", reminder)) + } else { + //p.API.LogInfo("unknown reminder: " + fmt.Sprintf("%v", reminder)) } } } diff --git a/server/occurrence.go b/server/occurrence.go index e18237a..6316d81 100755 --- a/server/occurrence.go +++ b/server/occurrence.go @@ -938,7 +938,7 @@ func (p *Plugin) everyEN(when string, user *model.User) (times []time.Time, err chronoTime = strings.Trim(dateTimeSplit[1], " ") } - if chronoDate == T("weekday") || chronoDate == T("weekdaysgh") { + if chronoDate == T("weekday") || chronoDate == T("weekdays") { chronoDate = T("monday") + "," + T("tuesday") + "," + T("wednesday") + "," + T("thursday") + "," + T("friday") } days := p.regSplit(chronoDate, "("+T("and")+")|(,)")