From efc003a7190876cb2761642b655e69094c154ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 8 Jan 2024 23:24:17 +0100 Subject: [PATCH] chore: cleanup code --- lib/api/wallet.dart | 13 +------------ lib/views/home.dart | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/api/wallet.dart b/lib/api/wallet.dart index 16ac990..077cea5 100644 --- a/lib/api/wallet.dart +++ b/lib/api/wallet.dart @@ -1,7 +1,6 @@ import 'package:currency_picker/currency_picker.dart'; import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:logger/logger.dart'; import 'package:prasule/api/category.dart'; import 'package:prasule/api/recurring_entry.dart'; import 'package:prasule/api/wallet_entry.dart'; @@ -57,11 +56,9 @@ class Wallet { /// Getter for the next unused unique number ID in the wallet's **entry** list int get nextId { var id = 1; - logger.d("Making ID after ${entries.length} entries"); while (entries.where((element) => element.id == id).isNotEmpty) { id++; // create unique ID } - logger.d("New ID: $id\nLast entry ID: ${entries.lastOrNull?.id}"); return id; } @@ -99,21 +96,13 @@ class Wallet { ..d("Current entry count: ${entries.length}"); recurringEntries[recurringEntries.indexOf(ent)].lastRunDate = m; // update date on recurring entry - logger.i(recurringEntries[recurringEntries.indexOf(ent)].lastRunDate); - - var id = 1; - logger.d("Making ID after ${entries.length} entries"); - while (entries.where((element) => element.id == id).isNotEmpty) { - id++; // create unique ID - } - logger.d("New ID: $id\nLast entry ID: ${entries.lastOrNull?.id}"); final addedEntry = WalletSingleEntry( data: recurringEntries[recurringEntries.indexOf(ent)].data, type: recurringEntries[recurringEntries.indexOf(ent)].type, date: m, category: recurringEntries[recurringEntries.indexOf(ent)].category, - id: id, + id: nextId, ); entries.add(addedEntry); diff --git a/lib/views/home.dart b/lib/views/home.dart index f0c24b3..f18722a 100644 --- a/lib/views/home.dart +++ b/lib/views/home.dart @@ -221,7 +221,6 @@ class _HomeViewState extends State { ), ); wallets = await WalletManager.listWallets(); - logger.i(wallets.length); selectedWallet = wallets.last; setState(() {}); return;