fix: lint errors
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
32cb200f87
commit
4018bd6078
|
@ -143,8 +143,7 @@ func ParseTaskFromVTODO(content string) (vTask *models.Task, err error) {
|
|||
|
||||
reminders := make([]*models.TaskReminder, 0)
|
||||
for _, vAlarm := range vTodo.SubComponents() {
|
||||
switch vAlarm := vAlarm.(type) {
|
||||
case *ics.VAlarm:
|
||||
if vAlarm, ok := vAlarm.(*ics.VAlarm); ok {
|
||||
reminders = parseVAlarm(vAlarm, reminders)
|
||||
}
|
||||
}
|
||||
|
@ -158,14 +157,14 @@ func ParseTaskFromVTODO(content string) (vTask *models.Task, err error) {
|
|||
func parseVAlarm(vAlarm *ics.VAlarm, reminders []*models.TaskReminder) []*models.TaskReminder {
|
||||
for _, property := range vAlarm.UnknownPropertiesIANAProperties() {
|
||||
if property.IANAToken == "TRIGGER" {
|
||||
if len(property.ICalParameters["VALUE"]) > 0 {
|
||||
switch property.ICalParameters["VALUE"][0] {
|
||||
case "DATE-TIME":
|
||||
switch {
|
||||
case len(property.ICalParameters["VALUE"]) > 0:
|
||||
if property.ICalParameters["VALUE"][0] == "DATE-TIME" {
|
||||
// Example: TRIGGER;VALUE=DATE-TIME:20181201T011210Z
|
||||
reminders = append(reminders, &models.TaskReminder{
|
||||
Reminder: caldavTimeToTimestamp(property.Value)})
|
||||
}
|
||||
} else if len(property.ICalParameters["RELATED"]) > 0 {
|
||||
case len(property.ICalParameters["RELATED"]) > 0:
|
||||
duration := parseDuration(property.Value)
|
||||
switch property.ICalParameters["RELATED"][0] {
|
||||
case "START":
|
||||
|
@ -179,14 +178,12 @@ func parseVAlarm(vAlarm *ics.VAlarm, reminders []*models.TaskReminder) []*models
|
|||
RelativePeriod: int64(duration.Seconds()),
|
||||
RelativeTo: models.ReminderRelationEndDate})
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
duration := parseDuration(property.Value)
|
||||
if duration != 0 {
|
||||
// Example: TRIGGER:-PT60M
|
||||
reminders = append(reminders, &models.TaskReminder{
|
||||
RelativePeriod: int64(duration.Seconds()),
|
||||
RelativeTo: models.ReminderRelationDueDate})
|
||||
}
|
||||
// Example: TRIGGER:-PT60M
|
||||
reminders = append(reminders, &models.TaskReminder{
|
||||
RelativePeriod: int64(duration.Seconds()),
|
||||
RelativeTo: models.ReminderRelationDueDate})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,6 +166,10 @@ DESCRIPTION:Lorem Ipsum
|
|||
DTSTART:20230228T170000Z
|
||||
DUE:20230304T150000Z
|
||||
BEGIN:VALARM
|
||||
TRIGGER:PT0S
|
||||
ACTION:DISPLAY
|
||||
END:VALARM
|
||||
BEGIN:VALARM
|
||||
TRIGGER:-PT60M
|
||||
ACTION:DISPLAY
|
||||
END:VALARM
|
||||
|
@ -187,6 +191,10 @@ END:VCALENDAR`,
|
|||
StartDate: time.Date(2023, 2, 28, 17, 0, 0, 0, config.GetTimeZone()),
|
||||
DueDate: time.Date(2023, 3, 4, 15, 0, 0, 0, config.GetTimeZone()),
|
||||
Reminders: []*models.TaskReminder{
|
||||
{
|
||||
RelativeTo: models.ReminderRelationDueDate,
|
||||
RelativePeriod: 0,
|
||||
},
|
||||
{
|
||||
RelativeTo: models.ReminderRelationDueDate,
|
||||
RelativePeriod: -3600,
|
||||
|
|
Loading…
Reference in New Issue