Refactor supplement intake handling to support fractional units and update notification service initialization for Linux

This commit is contained in:
2025-08-26 01:35:43 +02:00
parent 05a9d13164
commit e6181add08
7 changed files with 127 additions and 54 deletions

View File

@@ -3,7 +3,7 @@ class SupplementIntake {
final int supplementId;
final DateTime takenAt;
final double dosageTaken; // Total dosage amount taken
final int unitsTaken; // Number of units taken
final double unitsTaken; // Number of units taken (can be fractional)
final String? notes;
SupplementIntake({
@@ -32,7 +32,7 @@ class SupplementIntake {
supplementId: map['supplementId'],
takenAt: DateTime.parse(map['takenAt']),
dosageTaken: map['dosageTaken'],
unitsTaken: map['unitsTaken'] ?? 1, // Default for backwards compatibility
unitsTaken: (map['unitsTaken'] ?? 1).toDouble(), // Default for backwards compatibility
notes: map['notes'],
);
}
@@ -42,7 +42,7 @@ class SupplementIntake {
int? supplementId,
DateTime? takenAt,
double? dosageTaken,
int? unitsTaken,
double? unitsTaken,
String? notes,
}) {
return SupplementIntake(