various updates
This commit is contained in:
parent
481dc60996
commit
38f43a48ec
@ -18,8 +18,8 @@ import 'package:diameter/screens/bolus/bolus_profile_detail.dart';
|
||||
import 'package:diameter/screens/log/log_overview.dart';
|
||||
import 'package:diameter/screens/reports/daily_chart.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_entry.dart';
|
||||
import 'package:diameter/screens/log/log_event_detail.dart';
|
||||
import 'package:diameter/screens/log/log_event_list.dart';
|
||||
import 'package:diameter/screens/log/log_event/log_event_detail.dart';
|
||||
import 'package:diameter/screens/log/log_event/log_event_list.dart';
|
||||
import 'package:diameter/screens/meal/meal_detail.dart';
|
||||
import 'package:diameter/screens/meal/meal_list.dart';
|
||||
import 'package:diameter/screens/reports/export.dart';
|
||||
|
@ -68,19 +68,4 @@ class LogEntry {
|
||||
String toString() {
|
||||
return DateTimeUtils.displayDateTime(time);
|
||||
}
|
||||
|
||||
static List<LogEntry> getAllForDate(DateTime date) {
|
||||
DateTime startOfDay = DateTime(date.year, date.month, date.day);
|
||||
DateTime endOfDay = startOfDay.add(const Duration(days: 1));
|
||||
QueryBuilder<LogEntry> builder = box.query(LogEntry_.deleted.equals(false))
|
||||
..order(LogEntry_.time, flags: Order.descending);
|
||||
return builder.build().find().where((entry) {
|
||||
return (entry.time.compareTo(startOfDay) >= 0 && entry.time.isBefore(endOfDay));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return DateTimeUtils.displayDateTime(time);
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ import 'package:diameter/screens/log/log_entry/log_bolus_detail.dart';
|
||||
import 'package:diameter/screens/log/log_overview.dart';
|
||||
import 'package:diameter/screens/reports/daily_chart.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_entry.dart';
|
||||
import 'package:diameter/screens/log/log_event_detail.dart';
|
||||
import 'package:diameter/screens/log/log_event_list.dart';
|
||||
import 'package:diameter/screens/log/log_event/log_event_detail.dart';
|
||||
import 'package:diameter/screens/log/log_event/log_event_list.dart';
|
||||
import 'package:diameter/screens/log/log_entry/log_meal_detail.dart';
|
||||
import 'package:diameter/screens/meal/meal_detail.dart';
|
||||
import 'package:diameter/screens/meal/meal_list.dart';
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1234,7 +1234,7 @@ ModelDefinition getObjectBoxModel() {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = LogEventType(
|
||||
final object = Bolus(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
@ -1250,6 +1250,190 @@ ModelDefinition getObjectBoxModel() {
|
||||
.vTableGetNullable(buffer, rootOffset, 14),
|
||||
mmolPerL: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 16));
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
BolusProfile: EntityDefinition<BolusProfile>(
|
||||
model: _entities[3],
|
||||
toOneRelations: (BolusProfile object) => [],
|
||||
toManyRelations: (BolusProfile object) => {},
|
||||
getId: (BolusProfile object) => object.id,
|
||||
setId: (BolusProfile object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (BolusProfile object, fb.Builder fbb) {
|
||||
final nameOffset = fbb.writeString(object.name);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(6);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, nameOffset);
|
||||
fbb.addBool(2, object.active);
|
||||
fbb.addOffset(3, notesOffset);
|
||||
fbb.addBool(4, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = BolusProfile(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 12, false),
|
||||
name: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''),
|
||||
active:
|
||||
const fb.BoolReader().vTableGet(buffer, rootOffset, 8, false),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 10));
|
||||
|
||||
return object;
|
||||
}),
|
||||
LogEntry: EntityDefinition<LogEntry>(
|
||||
model: _entities[4],
|
||||
toOneRelations: (LogEntry object) => [],
|
||||
toManyRelations: (LogEntry object) => {},
|
||||
getId: (LogEntry object) => object.id,
|
||||
setId: (LogEntry object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (LogEntry object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(11);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.mgPerDl);
|
||||
fbb.addFloat64(3, object.mmolPerL);
|
||||
fbb.addOffset(7, notesOffset);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.addFloat64(9, object.glucoseTrend);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = LogEntry(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
mgPerDl: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 8),
|
||||
mmolPerL: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
glucoseTrend: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 22),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 18));
|
||||
|
||||
return object;
|
||||
}),
|
||||
LogEvent: EntityDefinition<LogEvent>(
|
||||
model: _entities[5],
|
||||
toOneRelations: (LogEvent object) =>
|
||||
[object.eventType, object.bolusProfile, object.basalProfile],
|
||||
toManyRelations: (LogEvent object) => {},
|
||||
getId: (LogEvent object) => object.id,
|
||||
setId: (LogEvent object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (LogEvent object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(13);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.endTime?.millisecondsSinceEpoch);
|
||||
fbb.addBool(3, object.hasEndTime);
|
||||
fbb.addOffset(4, notesOffset);
|
||||
fbb.addInt64(7, object.eventType.targetId);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.addInt64(9, object.bolusProfile.targetId);
|
||||
fbb.addInt64(10, object.basalProfile.targetId);
|
||||
fbb.addInt64(11, object.reminderDuration);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
final endTimeValue =
|
||||
const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 8);
|
||||
final object = LogEvent(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
endTime: endTimeValue == null
|
||||
? null
|
||||
: DateTime.fromMillisecondsSinceEpoch(endTimeValue),
|
||||
hasEndTime: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 10, false),
|
||||
reminderDuration: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 26),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 12));
|
||||
object.eventType.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.eventType.attach(store);
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
object.basalProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 24, 0);
|
||||
object.basalProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
LogEventType: EntityDefinition<LogEventType>(
|
||||
model: _entities[6],
|
||||
toOneRelations: (LogEventType object) =>
|
||||
[object.bolusProfile, object.basalProfile],
|
||||
toManyRelations: (LogEventType object) => {},
|
||||
getId: (LogEventType object) => object.id,
|
||||
setId: (LogEventType object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (LogEventType object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(9);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addBool(2, object.hasEndTime);
|
||||
fbb.addInt64(3, object.defaultReminderDuration);
|
||||
fbb.addOffset(4, notesOffset);
|
||||
fbb.addBool(5, object.deleted);
|
||||
fbb.addInt64(6, object.bolusProfile.targetId);
|
||||
fbb.addInt64(7, object.basalProfile.targetId);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = LogEventType(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 14, false),
|
||||
value: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''),
|
||||
hasEndTime:
|
||||
const fb.BoolReader().vTableGet(buffer, rootOffset, 8, false),
|
||||
defaultReminderDuration: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 12));
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
@ -1303,353 +1487,6 @@ ModelDefinition getObjectBoxModel() {
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = LogMeal(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 36, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
amount:
|
||||
const fb.Float64Reader().vTableGet(buffer, rootOffset, 38, 0),
|
||||
carbsRatio: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 8),
|
||||
portionSize: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
totalCarbs: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 40),
|
||||
notes: const fb.StringReader()
|
||||
.vTableGetNullable(buffer, rootOffset, 20))
|
||||
..bolus = const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 14);
|
||||
object.logEntry.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||
object.logEntry.attach(store);
|
||||
object.meal.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 24, 0);
|
||||
object.meal.attach(store);
|
||||
object.mealSource.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 26, 0);
|
||||
object.mealSource.attach(store);
|
||||
object.mealCategory.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 28, 0);
|
||||
object.mealCategory.attach(store);
|
||||
object.mealPortionType.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 30, 0);
|
||||
object.mealPortionType.attach(store);
|
||||
object.portionSizeAccuracy.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 32, 0);
|
||||
object.portionSizeAccuracy.attach(store);
|
||||
object.carbsRatioAccuracy.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 34, 0);
|
||||
object.carbsRatioAccuracy.attach(store);
|
||||
return object;
|
||||
}),
|
||||
Meal: EntityDefinition<Meal>(
|
||||
model: _entities[8],
|
||||
toOneRelations: (Meal object) => [
|
||||
object.mealSource,
|
||||
object.mealCategory,
|
||||
object.mealPortionType,
|
||||
object.portionSizeAccuracy,
|
||||
object.carbsRatioAccuracy
|
||||
],
|
||||
toManyRelations: (Meal object) => {},
|
||||
getId: (Meal object) => object.id,
|
||||
setId: (Meal object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Meal object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(16);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addFloat64(2, object.carbsRatio);
|
||||
fbb.addFloat64(3, object.portionSize);
|
||||
fbb.addFloat64(4, object.carbsPerPortion);
|
||||
fbb.addInt64(5, object.delayedBolusDuration);
|
||||
fbb.addOffset(7, notesOffset);
|
||||
fbb.addInt64(8, object.mealSource.targetId);
|
||||
fbb.addInt64(9, object.mealCategory.targetId);
|
||||
fbb.addInt64(10, object.mealPortionType.targetId);
|
||||
fbb.addInt64(11, object.portionSizeAccuracy.targetId);
|
||||
fbb.addInt64(12, object.carbsRatioAccuracy.targetId);
|
||||
fbb.addBool(13, object.deleted);
|
||||
fbb.addFloat64(14, object.delayedBolusPercentage);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Meal(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 30, false),
|
||||
value:
|
||||
const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''),
|
||||
carbsRatio: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 8),
|
||||
portionSize: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
carbsPerPortion: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 12),
|
||||
delayedBolusDuration: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 14),
|
||||
delayedBolusPercentage: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 32),
|
||||
notes: const fb.StringReader()
|
||||
.vTableGetNullable(buffer, rootOffset, 18));
|
||||
object.mealSource.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0);
|
||||
object.mealSource.attach(store);
|
||||
object.mealCategory.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||
object.mealCategory.attach(store);
|
||||
object.mealPortionType.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 24, 0);
|
||||
object.mealPortionType.attach(store);
|
||||
object.portionSizeAccuracy.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 26, 0);
|
||||
object.portionSizeAccuracy.attach(store);
|
||||
object.carbsRatioAccuracy.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 28, 0);
|
||||
object.carbsRatioAccuracy.attach(store);
|
||||
return object;
|
||||
}),
|
||||
BolusProfile: EntityDefinition<BolusProfile>(
|
||||
model: _entities[3],
|
||||
toOneRelations: (BolusProfile object) => [],
|
||||
toManyRelations: (BolusProfile object) => {},
|
||||
getId: (BolusProfile object) => object.id,
|
||||
setId: (BolusProfile object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (MealCategory object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(6);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, nameOffset);
|
||||
fbb.addBool(2, object.active);
|
||||
fbb.addOffset(3, notesOffset);
|
||||
fbb.addBool(4, object.deleted);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = MealCategory(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 12, false),
|
||||
name: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''),
|
||||
active:
|
||||
const fb.BoolReader().vTableGet(buffer, rootOffset, 8, false),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 10));
|
||||
|
||||
return object;
|
||||
}),
|
||||
LogEntry: EntityDefinition<LogEntry>(
|
||||
model: _entities[4],
|
||||
toOneRelations: (LogEntry object) => [],
|
||||
toManyRelations: (LogEntry object) => {},
|
||||
getId: (LogEntry object) => object.id,
|
||||
setId: (LogEntry object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (MealPortionType object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(11);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.mgPerDl);
|
||||
fbb.addFloat64(3, object.mmolPerL);
|
||||
fbb.addOffset(7, notesOffset);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.addFloat64(9, object.glucoseTrend);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = MealPortionType(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
mgPerDl: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 8),
|
||||
mmolPerL: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
glucoseTrend: const fb.Float64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 22),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 18));
|
||||
|
||||
return object;
|
||||
}),
|
||||
LogEvent: EntityDefinition<LogEvent>(
|
||||
model: _entities[5],
|
||||
toOneRelations: (LogEvent object) =>
|
||||
[object.eventType, object.bolusProfile, object.basalProfile],
|
||||
toManyRelations: (LogEvent object) => {},
|
||||
getId: (LogEvent object) => object.id,
|
||||
setId: (LogEvent object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (MealSource object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(13);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.time.millisecondsSinceEpoch);
|
||||
fbb.addInt64(2, object.endTime?.millisecondsSinceEpoch);
|
||||
fbb.addBool(3, object.hasEndTime);
|
||||
fbb.addOffset(4, notesOffset);
|
||||
fbb.addInt64(7, object.eventType.targetId);
|
||||
fbb.addBool(8, object.deleted);
|
||||
fbb.addInt64(9, object.bolusProfile.targetId);
|
||||
fbb.addInt64(10, object.basalProfile.targetId);
|
||||
fbb.addInt64(11, object.reminderDuration);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = MealSource(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 20, false),
|
||||
time: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)),
|
||||
endTime: endTimeValue == null
|
||||
? null
|
||||
: DateTime.fromMillisecondsSinceEpoch(endTimeValue),
|
||||
hasEndTime: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 10, false),
|
||||
reminderDuration: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 26),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 12));
|
||||
object.eventType.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.eventType.attach(store);
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 22, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
object.basalProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 24, 0);
|
||||
object.basalProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
LogEventType: EntityDefinition<LogEventType>(
|
||||
model: _entities[6],
|
||||
toOneRelations: (LogEventType object) =>
|
||||
[object.bolusProfile, object.basalProfile],
|
||||
toManyRelations: (LogEventType object) => {},
|
||||
getId: (LogEventType object) => object.id,
|
||||
setId: (LogEventType object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (LogBolus object, fb.Builder fbb) {
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(9);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addBool(2, object.hasEndTime);
|
||||
fbb.addInt64(3, object.defaultReminderDuration);
|
||||
fbb.addOffset(4, notesOffset);
|
||||
fbb.addBool(5, object.deleted);
|
||||
fbb.addInt64(6, object.bolusProfile.targetId);
|
||||
fbb.addInt64(7, object.basalProfile.targetId);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = LogBolus(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 14, false),
|
||||
value: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''),
|
||||
hasEndTime:
|
||||
const fb.BoolReader().vTableGet(buffer, rootOffset, 8, false),
|
||||
defaultReminderDuration: const fb.Int64Reader()
|
||||
.vTableGetNullable(buffer, rootOffset, 10),
|
||||
notes: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGetNullable(buffer, rootOffset, 12));
|
||||
object.bolusProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0);
|
||||
object.bolusProfile.attach(store);
|
||||
object.basalProfile.targetId =
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);
|
||||
object.basalProfile.attach(store);
|
||||
return object;
|
||||
}),
|
||||
LogMeal: EntityDefinition<LogMeal>(
|
||||
model: _entities[7],
|
||||
toOneRelations: (LogMeal object) => [
|
||||
object.logEntry,
|
||||
object.meal,
|
||||
object.mealSource,
|
||||
object.mealCategory,
|
||||
object.mealPortionType,
|
||||
object.portionSizeAccuracy,
|
||||
object.carbsRatioAccuracy
|
||||
],
|
||||
toManyRelations: (LogMeal object) => {},
|
||||
getId: (LogMeal object) => object.id,
|
||||
setId: (LogMeal object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Accuracy object, fb.Builder fbb) {
|
||||
final valueOffset = fbb.writeString(object.value);
|
||||
final notesOffset =
|
||||
object.notes == null ? null : fbb.writeString(object.notes!);
|
||||
fbb.startTable(20);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, valueOffset);
|
||||
fbb.addFloat64(2, object.carbsRatio);
|
||||
fbb.addFloat64(3, object.portionSize);
|
||||
fbb.addFloat64(5, object.bolus);
|
||||
fbb.addOffset(8, notesOffset);
|
||||
fbb.addInt64(9, object.logEntry.targetId);
|
||||
fbb.addInt64(10, object.meal.targetId);
|
||||
fbb.addInt64(11, object.mealSource.targetId);
|
||||
fbb.addInt64(12, object.mealCategory.targetId);
|
||||
fbb.addInt64(13, object.mealPortionType.targetId);
|
||||
fbb.addInt64(14, object.portionSizeAccuracy.targetId);
|
||||
fbb.addInt64(15, object.carbsRatioAccuracy.targetId);
|
||||
fbb.addBool(16, object.deleted);
|
||||
fbb.addFloat64(17, object.amount);
|
||||
fbb.addFloat64(18, object.totalCarbs);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Accuracy(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
deleted: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 36, false),
|
||||
|
12
pubspec.lock
12
pubspec.lock
@ -249,6 +249,11 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -270,6 +275,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.13.4"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
Loading…
Reference in New Issue
Block a user