@@ -428,32 +428,34 @@ func (rd *ReminderData) NotesApprachingDueDate(view string) Notes {
428428 // assuming there are at least 100 notes (on average)
429429 currentNotes := make ([]* Note , 0 , 100 )
430430 repeatTagIDs := rd .TagIdsForGroup ("repeat" )
431+ // populate tempDueDate
432+ pendingNotes .PopulateTempDueDate ()
431433 // populating currentNotes
432434 for _ , note := range pendingNotes {
433435 noteIDsWithRepeat := utils .GetCommonMembersOfSlices (note .TagIds , repeatTagIDs )
434436 // first process notes WITHOUT tag with group "repeat"
435437 // start showing such notes 7 days in advance from their due date, and until they are marked done
436- minDay := note .CompleteBy - 7 * 24 * 60 * 60
438+ minDay := note .tempDueDate - 7 * 24 * 60 * 60
437439 if view == "long" {
438- minDay = note .CompleteBy - 365 * 24 * 60 * 60
440+ minDay = note .tempDueDate - 365 * 24 * 60 * 60
439441 }
440442 currentTimestamp := utils .CurrentUnixTimestamp ()
441- if (len (noteIDsWithRepeat ) == 0 ) && (note .CompleteBy != 0 ) && (currentTimestamp >= minDay ) {
443+ if (len (noteIDsWithRepeat ) == 0 ) && (note .tempDueDate != 0 ) && (currentTimestamp >= minDay ) {
442444 currentNotes = append (currentNotes , note )
443445 }
444446 // check notes with tag with group "repeat"
445447 // start showing notes with "repeat-annually" 7 days in advance
446448 // start showing notes with "repeat-monthly" 3 days in advance
447449 // don't show such notes after their due date is past by 2 day
448- if (len (noteIDsWithRepeat ) > 0 ) && (note .CompleteBy != 0 ) {
450+ if (len (noteIDsWithRepeat ) > 0 ) && (note .tempDueDate != 0 ) {
449451 // check for repeat-annually tag
450- // note: for the CompleteBy date of the note, we accept only date
452+ // note: for the tempDueDate date of the note, we accept only date
451453 // so, even if there is a time element recorded the the timestamp,
452454 // we ignore it
453455 repeatAnnuallyTag := rd .TagFromSlug ("repeat-annually" )
454456 repeatMonthlyTag := rd .TagFromSlug ("repeat-monthly" )
455457 if (repeatAnnuallyTag != nil ) && utils .IsMemberOfSlice (repeatAnnuallyTag .Id , note .TagIds ) {
456- _ , noteMonth , noteDay := utils .UnixTimestampToTime (note .CompleteBy ).Date ()
458+ _ , noteMonth , noteDay := utils .UnixTimestampToTime (note .tempDueDate ).Date ()
457459 noteTimestampCurrent := utils .UnixTimestampForCorrespondingCurrentYear (int (noteMonth ), noteDay )
458460 noteTimestampPrevious := noteTimestampCurrent - 365 * 24 * 60 * 60
459461 noteTimestampNext := noteTimestampCurrent + 365 * 24 * 60 * 60
@@ -464,14 +466,14 @@ func (rd *ReminderData) NotesApprachingDueDate(view string) Notes {
464466 }
465467 shouldDisplay , matchingTimestamp := utils .MatchedTimestamp (noteTimestampCurrent , noteTimestampPrevious , noteTimestampNext , daysBefore , daysAfter )
466468 // temporarity update note's timestamp
467- note .CompleteBy = matchingTimestamp
469+ note .tempDueDate = matchingTimestamp
468470 if shouldDisplay {
469471 currentNotes = append (currentNotes , note )
470472 }
471473 }
472474 // check for repeat-monthly tag
473475 if (repeatMonthlyTag != nil ) && utils .IsMemberOfSlice (repeatMonthlyTag .Id , note .TagIds ) {
474- _ , _ , noteDay := utils .UnixTimestampToTime (note .CompleteBy ).Date ()
476+ _ , _ , noteDay := utils .UnixTimestampToTime (note .tempDueDate ).Date ()
475477 noteTimestampCurrent := utils .UnixTimestampForCorrespondingCurrentYearMonth (noteDay )
476478 noteTimestampPrevious := noteTimestampCurrent - 30 * 24 * 60 * 60
477479 noteTimestampNext := noteTimestampCurrent + 30 * 24 * 60 * 60
@@ -482,7 +484,7 @@ func (rd *ReminderData) NotesApprachingDueDate(view string) Notes {
482484 }
483485 shouldDisplay , matchingTimestamp := utils .MatchedTimestamp (noteTimestampCurrent , noteTimestampPrevious , noteTimestampNext , daysBefore , daysAfter )
484486 // temporarity update note's timestamp
485- note .CompleteBy = matchingTimestamp
487+ note .tempDueDate = matchingTimestamp
486488 if shouldDisplay {
487489 currentNotes = append (currentNotes , note )
488490 }
0 commit comments