Skip to content

Commit

Permalink
Fix fitness save button by allowing fitness table to completely get r…
Browse files Browse the repository at this point in the history
…ecreated during clear database event (#315)

* Fix fitness save button by allowing fitness table to completely get recreated during clear database event

* bump v0.8.8+44
  • Loading branch information
andreped authored Sep 24, 2024
1 parent bd0943e commit a5fd32c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/core/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@ class DatabaseHelper {

Future<void> clearDatabase(String table) async {
final db = await database;
await db.delete(table);
if (table == 'fitness') {
await db.execute('DROP TABLE IF EXISTS fitness');
await db.execute(
'CREATE TABLE fitness(id INTEGER PRIMARY KEY AUTOINCREMENT, weight TEXT, height INTEGER, age INTEGER, timestamp TEXT)',
);
print('Fitness table recreated successfully');
} else {
await db.delete(table);
}
}

Future<List<String>> getRecordedExercises() async {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.8.7+43
version: 0.8.8+44

environment:
sdk: '>=3.4.3 <4.0.0'
Expand Down

0 comments on commit a5fd32c

Please sign in to comment.