Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bannzai committed Feb 11, 2025
1 parent b3bd14e commit da68ae9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/entity/pill_sheet_group.codegen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, today()))?.number ?? 0;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, today()))?.number ?? 0;
}
Expand All @@ -91,6 +93,8 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, activePillSheetLastTakenDate))?.number ?? 0;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, activePillSheetLastTakenDate))?.number ?? 0;
}
Expand All @@ -101,6 +105,8 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForCyclicSequential.last.number;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.last.number;
}
Expand All @@ -125,6 +131,7 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return _pillNumberInPillSheet(pillNumberInPillSheet: lastTakenPillNumber);
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return _cycleSequentialPillSheetNumber(pageIndex: pillSheet.groupIndex, pillNumberInPillSheet: lastTakenPillNumber);
}
Expand Down Expand Up @@ -164,6 +171,7 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
return _pillNumberInPillSheet(pillNumberInPillSheet: pillNumberInPillSheet);
case PillSheetAppearanceMode.date:
return _pillNumberInPillSheet(pillNumberInPillSheet: pillNumberInPillSheet);
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet);
}
Expand All @@ -179,6 +187,7 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
return pillNumbersInPillSheet.firstWhere((e) => isSameDay(e.date, date)).number;
case PillSheetAppearanceMode.date:
return pillNumbersInPillSheet.firstWhere((e) => isSameDay(e.date, date)).number;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhere((e) => isSameDay(e.date, date)).number;
}
Expand Down Expand Up @@ -206,6 +215,7 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
PillSheetAppearanceMode.date => premiumOrTrial
? _displayPillSheetDate(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet)
: _pillNumberInPillSheet(pillNumberInPillSheet: pillNumberInPillSheet),
PillSheetAppearanceMode.sequential => _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet),
PillSheetAppearanceMode.cyclicSequential => _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet),
};
return pillNumber.toString();
Expand Down Expand Up @@ -271,6 +281,7 @@ extension PillSheetGroupPillNumberDomain on PillSheetGroup {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return pillNumbersInPillSheet;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential;
}
Expand Down Expand Up @@ -509,8 +520,8 @@ enum PillSheetAppearanceMode {
@JsonValue('date')
date,
// 古い値。cyclicSequentialに変更した。一時的に両立されていた
// @JsonValue('sequential')
// sequential,
@JsonValue('sequential')
sequential,
@JsonValue('cyclicSequential')
cyclicSequential,
}
Expand All @@ -521,6 +532,7 @@ extension PillSheetAppearanceModeExt on PillSheetAppearanceMode {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return false;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class RecordPageRestDurationDialogTitle extends StatelessWidget {
.displayPillTakeDate(pillSheetGroup.lastTakenPillSheetOrFirstPillSheet.lastTakenOrZeroPillNumber + 1);
final dateString = DateTimeFormatter.monthAndDay(date);
return dateString;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return L.withNumber((pillSheetGroup.sequentialLastTakenPillNumber + 1).toString());
}
Expand Down

0 comments on commit da68ae9

Please sign in to comment.