Options fix
clean up and fixes - Heute gefixt - Code Cleanup NotificationScheduleItemViewModel -fixed NotificationScheduleItemViewModel for Windows compat push implementation Push fixes Push benachrichtungen eingebaut - Status bei push - Push auch in background - Toggle für symtome angepasst push system change exporter update Optionen fix - Optionen aufgeteilt auf 3 tabs - Anpassungen haben jetzt Farbslider Optimierung fix
This commit is contained in:
@@ -16,6 +16,7 @@ public class HealthEntryRepository
|
||||
public async Task<int> AddQuickEntryAsync(
|
||||
HealthState state,
|
||||
int? activityId = null,
|
||||
int? activityDurationMinutes = null,
|
||||
IEnumerable<int>? symptomIds = null,
|
||||
DateTime? timestamp = null,
|
||||
EntrySource source = EntrySource.App)
|
||||
@@ -23,6 +24,7 @@ public class HealthEntryRepository
|
||||
await _database.InitAsync();
|
||||
|
||||
var effectiveTimestamp = timestamp ?? DateTime.Now;
|
||||
|
||||
var entry = new HealthEntry
|
||||
{
|
||||
EntryDate = effectiveTimestamp.Date,
|
||||
@@ -31,12 +33,14 @@ public class HealthEntryRepository
|
||||
Source = source,
|
||||
DayPart = null,
|
||||
ActivityId = NormalizeActivityId(activityId),
|
||||
ActivityDurationMinutes = NormalizeActivityDuration(activityDurationMinutes),
|
||||
CreatedAt = DateTime.Now,
|
||||
UpdatedAt = DateTime.Now
|
||||
};
|
||||
|
||||
await _database.Connection.InsertAsync(entry);
|
||||
await _symptomRepository.SetSymptomsForEntryAsync(entry.Id, symptomIds);
|
||||
|
||||
return entry.Id;
|
||||
}
|
||||
|
||||
@@ -45,12 +49,14 @@ public class HealthEntryRepository
|
||||
DayPart part = DayPart.Morning,
|
||||
HealthState state = HealthState.Gray,
|
||||
int? activityId = null,
|
||||
int? activityDurationMinutes = null,
|
||||
IEnumerable<int>? symptomIds = null,
|
||||
EntrySource source = EntrySource.Backfill)
|
||||
{
|
||||
await _database.InitAsync();
|
||||
|
||||
var slotTimestamp = BuildBackfillTimestamp(date, part);
|
||||
|
||||
var existing = await _database.Connection.Table<HealthEntry>()
|
||||
.FirstOrDefaultAsync(x => x.Timestamp == slotTimestamp);
|
||||
|
||||
@@ -64,12 +70,14 @@ public class HealthEntryRepository
|
||||
Source = source,
|
||||
DayPart = part,
|
||||
ActivityId = NormalizeActivityId(activityId),
|
||||
ActivityDurationMinutes = NormalizeActivityDuration(activityDurationMinutes),
|
||||
CreatedAt = DateTime.Now,
|
||||
UpdatedAt = DateTime.Now
|
||||
};
|
||||
|
||||
await _database.Connection.InsertAsync(entry);
|
||||
await _symptomRepository.SetSymptomsForEntryAsync(entry.Id, symptomIds);
|
||||
|
||||
return entry.Id;
|
||||
}
|
||||
|
||||
@@ -79,10 +87,12 @@ public class HealthEntryRepository
|
||||
existing.Source = source;
|
||||
existing.DayPart = part;
|
||||
existing.ActivityId = NormalizeActivityId(activityId);
|
||||
existing.ActivityDurationMinutes = NormalizeActivityDuration(activityDurationMinutes);
|
||||
existing.UpdatedAt = DateTime.Now;
|
||||
|
||||
await _database.Connection.UpdateAsync(existing);
|
||||
await _symptomRepository.SetSymptomsForEntryAsync(existing.Id, symptomIds);
|
||||
|
||||
return existing.Id;
|
||||
}
|
||||
|
||||
@@ -91,6 +101,7 @@ public class HealthEntryRepository
|
||||
DateTime date,
|
||||
HealthState state,
|
||||
int? activityId = null,
|
||||
int? activityDurationMinutes = null,
|
||||
IEnumerable<int>? symptomIds = null,
|
||||
DayPart? part = null,
|
||||
EntrySource? source = null)
|
||||
@@ -103,16 +114,23 @@ public class HealthEntryRepository
|
||||
if (entry is null)
|
||||
return;
|
||||
|
||||
var originalTimestamp = entry.Timestamp;
|
||||
|
||||
entry.EntryDate = date.Date;
|
||||
entry.State = state;
|
||||
entry.ActivityId = NormalizeActivityId(activityId);
|
||||
entry.ActivityDurationMinutes = NormalizeActivityDuration(activityDurationMinutes);
|
||||
entry.Source = source ?? entry.Source;
|
||||
entry.DayPart = part;
|
||||
|
||||
if (part.HasValue)
|
||||
{
|
||||
entry.Timestamp = BuildBackfillTimestamp(date, part.Value);
|
||||
else if (date.Date != entry.EntryDate.Date)
|
||||
entry.Timestamp = date.Date + entry.Timestamp.TimeOfDay;
|
||||
}
|
||||
else if (originalTimestamp.Date != date.Date)
|
||||
{
|
||||
entry.Timestamp = date.Date + originalTimestamp.TimeOfDay;
|
||||
}
|
||||
|
||||
entry.UpdatedAt = DateTime.Now;
|
||||
|
||||
@@ -189,5 +207,12 @@ public class HealthEntryRepository
|
||||
};
|
||||
|
||||
private static int? NormalizeActivityId(int? activityId) =>
|
||||
activityId.HasValue && activityId.Value > 0 ? activityId : null;
|
||||
}
|
||||
activityId.HasValue && activityId.Value > 0
|
||||
? activityId
|
||||
: null;
|
||||
|
||||
private static int? NormalizeActivityDuration(int? activityDurationMinutes) =>
|
||||
activityDurationMinutes.HasValue && activityDurationMinutes.Value > 0
|
||||
? activityDurationMinutes
|
||||
: null;
|
||||
}
|
||||
Reference in New Issue
Block a user