Skip to content

Commit

Permalink
feat: bring back workouts in calendar view
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Jan 8, 2025
1 parent b006cb2 commit f9c5f71
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 18 deletions.
9 changes: 9 additions & 0 deletions lib/database/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,15 @@ class JournalDb extends _$JournalDb {
return dbEntities.map(fromDbEntity).toList();
}

Future<List<JournalEntity>> sortedCalendarEntries({
required DateTime rangeStart,
required DateTime rangeEnd,
}) async {
final dbEntities =
await sortedCalenderEntriesInRange(rangeStart, rangeEnd).get();
return dbEntities.map(fromDbEntity).toList();
}

Future<int> getTaggedCount() async {
return (await countTagged().get()).first;
}
Expand Down
8 changes: 8 additions & 0 deletions lib/database/database.drift
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ SELECT * FROM journal
AND date_to <= :rangeEnd
ORDER BY date_from DESC;

sortedCalenderEntriesInRange:
SELECT * FROM journal
WHERE type in ('JournalEntry', 'WorkoutEntry') AND
deleted = false
AND date_from >= :rangeStart
AND date_to <= :rangeEnd
ORDER BY date_from DESC;

filteredByTagMatch:
SELECT * FROM journal
WHERE deleted = false
Expand Down
13 changes: 13 additions & 0 deletions lib/database/database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/features/calendar/state/day_view_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DayViewController extends _$DayViewController {
final data = <CalendarEventData<CalendarEvent>>[];
final start = now.dayAtMidnight.subtract(Duration(days: timeSpanDays));

final items = await db.sortedTextEntries(
final items = await db.sortedCalendarEntries(
rangeStart: start,
rangeEnd: now.add(const Duration(days: 1)).dayAtMidnight,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/features/calendar/state/day_view_controller.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class TimeByCategoryController extends _$TimeByCategoryController {
data[day] = <CategoryDefinition?, Duration>{};
});

final items = await db.sortedTextEntries(
final items = await db.sortedCalendarEntries(
rangeStart: start,
rangeEnd: now.add(const Duration(days: 1)).dayAtMidnight,
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/features/tasks/state/checklist_controller.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ packages:
dependency: "direct main"
description:
name: calendar_view
sha256: "40612640fc84b84ba6bc188315fa62b329c143b06599f00f144b5239a5b3be50"
sha256: "94b5ccc06f6ab11fa3e40eda19f6f925bc49a355dfad8cfafece3bad54ce9773"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
canonical_json:
dependency: transitive
description:
Expand Down Expand Up @@ -1035,10 +1035,10 @@ packages:
dependency: transitive
description:
name: flutter_quill_delta_from_html
sha256: "3809961f59b323e3ff368921c8f4a2ae559ff05a6bd132e565d7e6180db868e8"
sha256: "79405765612016de9de2361be86383360b0b43a6bf88b818c079a953583f1849"
url: "https://pub.dev"
source: hosted
version: "1.4.5"
version: "1.5.0"
flutter_quill_extensions:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1451,10 +1451,10 @@ packages:
dependency: transitive
description:
name: image_picker_platform_interface
sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80"
sha256: "886d57f0be73c4b140004e78b9f28a8914a09e50c2d816bdd0520051a71236a0"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
version: "2.10.1"
image_picker_windows:
dependency: transitive
description:
Expand Down Expand Up @@ -2200,10 +2200,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.5.0"
qr:
dependency: transitive
description:
Expand Down Expand Up @@ -3086,10 +3086,10 @@ packages:
dependency: transitive
description:
name: vector_graphics_codec
sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb"
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
url: "https://pub.dev"
source: hosted
version: "1.1.12"
version: "1.1.13"
vector_graphics_compiler:
dependency: transitive
description:
Expand Down Expand Up @@ -3126,10 +3126,10 @@ packages:
dependency: transitive
description:
name: video_player_android
sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898"
sha256: "7018dbcb395e2bca0b9a898e73989e67c0c4a5db269528e1b036ca38bcca0d0b"
url: "https://pub.dev"
source: hosted
version: "2.7.16"
version: "2.7.17"
video_player_avfoundation:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.553+2823
version: 0.9.553+2824

msix_config:
display_name: LottiApp
Expand Down

0 comments on commit f9c5f71

Please sign in to comment.