Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspfahl committed Aug 26, 2024
1 parent 5ad99fa commit 932639f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
23 changes: 2 additions & 21 deletions lib/model/Schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ class Schedule {
extractValue: (dayOfWeek) {
return dayOfWeek.index + 1;
},
shiftBack: (repetitionValue, from) {
final shift = repetitionValue * DayOfWeek.values.length; // period - 1, e.g. 2 weeks = 1 week, 3 weeks = 2 weeks
return from.subtract(Duration(days: shift));
},
) ?? nextRegularDueDate;
}

Expand All @@ -312,10 +308,7 @@ class Schedule {
},
extractValue: (dayOfMonth) {
return dayOfMonth;
},
shiftBack: (repetitionValue, from) {
return Jiffy.parseFromDateTime(from).subtract(months: repetitionValue).dateTime;
},
}
) ?? nextRegularDueDate;
}

Expand All @@ -326,10 +319,7 @@ class Schedule {
},
extractValue: (dayOfMonth) {
return dayOfMonth.value;
},
shiftBack: (repetitionValue, from) {
return Jiffy.parseFromDateTime(from).subtract(years: repetitionValue).dateTime;
},
}
) ?? nextRegularDueDate;
}
// bypass
Expand Down Expand Up @@ -380,7 +370,6 @@ class Schedule {
bool moveForward, {
required T Function (DateTime from) extractType,
required int Function (T) extractValue,
required DateTime Function (int repetitionValue, DateTime from) shiftBack,
}) {

//debugPrint("from=$from nextRegularDueDate=$nextRegularDueDate");
Expand Down Expand Up @@ -413,14 +402,6 @@ class Schedule {

//debugPrint("last = $last");
if (last != null) {
// if last is the max element in sorted, shift x days back
/*if (!sortedDescending.any((element) => extractValue(element) >= extractValue(extractType(last)))) {
final repetition = fromRepetitionStepToCustomRepetition(repetitionStep, customRepetition);
final corrected = shiftBack(repetition.repetitionValue - 1, last);
//debugPrint("corrected = $corrected");
return corrected;
}*/
return last;
}

Expand Down
3 changes: 3 additions & 0 deletions metadata/en-US/changelogs/10703.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Fix fixed and weekly based schedule due data calculation (#83)
* Fix wrong number of due and overdue schedules in overview
* Ensure selected due dates match selected week days (for fixed week based schedules)

0 comments on commit 932639f

Please sign in to comment.