mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
Refactor supplement intake handling to support fractional units and update notification service initialization for Linux
This commit is contained in:
@@ -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(
|
||||
|
Reference in New Issue
Block a user