Show-case implementation of how to calculate until when a wallet's balance lasts.
Details
Details
- Reviewers
machniak vanmeeuwen - Group Reviewers
Restricted Project - Commits
- rKda13578ce560: Wallet magic
$ ./artisan user:wallets john@kolab.org 5337dced-7227-4cac-8c66-4b4720cca873 $ ./artisan wallet:expected expect charging wallet 5337dced-7227-4cac-8c66-4b4720cca873 for user john@kolab.org with 999 $ ./artisan wallet:until $(./artisan user:wallets john@kolab.org) 0 lasts until 2020-04-08 15:10:21 (a month costs 3541) $ ./artisan wallet:set-balance $(./artisan user:wallets john@kolab.org) $(( 999 + 3541 )) $ ./artisan wallet:until $(./artisan user:wallets john@kolab.org) 4540 lasts until 2020-05-08 15:10:21 (a month costs 3541)
Diff Detail
Diff Detail
- Repository
- rK kolab
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I think we'll need this code as a method on the Wallet object, as it will be needed also for UI. And we need a test. I don't understand the code, so I might get back to it later.
src/app/Console/Commands/WalletUntil.php | ||
---|---|---|
70 | This is the same query but different order as above. I guess, we could do a single select. |
Comment Actions
- Remove superfluous commands already a part of different differentials
- Single query
- Some initial extras
- A simpler version of the same thing
Comment Actions
- Remove superfluous commands already a part of different differentials
- Single query
- Some initial extras
src/app/Utils.php | ||
---|---|---|
27 | Note that this is fixed in a different differential. |
Comment Actions
@vanmeeuwen, I rebased, fixed obvious bugs and refactored the code so now we have Wallet::balanceLastsUntil() that we need tests for in tests/Feature/WalletTest::testBalanceLastsUntil().