From e518f70dc98fcca5a0dd345081994179ff42d7fc Mon Sep 17 00:00:00 2001 From: Babichev Maxim Date: Thu, 19 Mar 2020 22:29:33 +0300 Subject: [PATCH 1/3] #150 Fixed problem with command --- src/Commands/RefreshBalance.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Commands/RefreshBalance.php b/src/Commands/RefreshBalance.php index 90e2e0840..6c7fdfc3e 100644 --- a/src/Commands/RefreshBalance.php +++ b/src/Commands/RefreshBalance.php @@ -39,13 +39,13 @@ public function handle(): void { app(ProxyService::class)->fresh(); app(DbService::class)->transaction(function () { - $wallet = config('wallet.wallet.table', 'wallets'); - app(DbService::class) - ->connection() - ->table($wallet) - ->update(['balance' => 0]); - if (app(DbService::class)->connection() instanceof SQLiteConnection) { + $wallet = config('wallet.wallet.table', 'wallets'); + app(DbService::class) + ->connection() + ->table($wallet) + ->update(['balance' => 0]); + $this->sqliteUpdate(); } else { $this->multiUpdate(); @@ -89,7 +89,7 @@ protected function multiUpdate(): void ->connection() ->table($wallet) ->joinSub($availableBalance, 'b', $joinClause, null, null, 'left') - ->update(['balance' => app(DbService::class)->raw('b.balance')]); + ->update(["$wallet.balance" => app(DbService::class)->raw('ifnull(b.balance, 0)')]); } } From 28ee4acb96a3ffaf850bb05a17377492d82b1c65 Mon Sep 17 00:00:00 2001 From: Babichev Maxim Date: Thu, 19 Mar 2020 22:33:16 +0300 Subject: [PATCH 2/3] update changelog.md --- changelog.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 9ee2820b9..2579efc15 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.2.1] - 2020-03-19 +### Fixed +- Fixed wallet recalculate command + ## [4.2.0] - 2020-03-08 ### Added @@ -453,7 +457,8 @@ The operation is now executed in the transaction and updates the new `refund` fi - Exceptions: AmountInvalid, BalanceIsEmpty. - Models: Transfer, Transaction. -[Unreleased]: https://github.com/bavix/laravel-wallet/compare/4.2.0...HEAD +[Unreleased]: https://github.com/bavix/laravel-wallet/compare/4.2.1...HEAD +[4.2.1]: https://github.com/bavix/laravel-wallet/compare/4.2.0...4.2.1 [4.2.0]: https://github.com/bavix/laravel-wallet/compare/4.1.2...4.2.0 [4.1.2]: https://github.com/bavix/laravel-wallet/compare/4.1.1...4.1.2 [4.1.1]: https://github.com/bavix/laravel-wallet/compare/4.1.0...4.1.1 From 1e2c56159e03a40b3b7c2c57d28a354e08dacb4f Mon Sep 17 00:00:00 2001 From: Babichev Maxim Date: Thu, 19 Mar 2020 22:34:42 +0300 Subject: [PATCH 3/3] add issue --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 2579efc15..d809ab535 100644 --- a/changelog.md +++ b/changelog.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [4.2.1] - 2020-03-19 ### Fixed -- Fixed wallet recalculate command +- Fixed wallet recalculate command #150 ## [4.2.0] - 2020-03-08