Skip to content

Commit

Permalink
v1.0.28 - Update getEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnie committed Jun 2, 2024
1 parent 9638948 commit c1fbbd6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/db/entries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,18 @@ class EntryService {
where: 'id = ?',
whereArgs: [id],
);

if (entries.isNotEmpty) {
return Entry.fromJson(entries.first);
Entry entry = Entry.fromJson(entries.first);
final List<Account> allAccounts = await AccountService().getAllAccounts();

// Create a map for quick account lookup by ID
var accountsMap = {for (var account in allAccounts) account.id: account};

entry.creditAccount = accountsMap[entry.creditAccountId];
entry.debitAccount = accountsMap[entry.debitAccountId];

return entry;
}
return null;
}
Expand Down

0 comments on commit c1fbbd6

Please sign in to comment.