From fb30f7ec8f5e09768861a25de90e7c0c84b95eac Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 2 Jan 2025 19:10:39 +0100 Subject: [PATCH 1/4] Update build script. --- .github/workflows/release.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb702f8e33..fb1234092a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -314,6 +314,7 @@ jobs: git push origin $releaseName gh release create $releaseName -p --verify-tag \ -t "Development release for $(date +'%Y-%m-%d')" \ + --latest=false \ -F output.txt fi @@ -327,6 +328,7 @@ jobs: git push origin $releaseName gh release create $releaseName -p --verify-tag \ -t "Branch release for $(date +'%Y-%m-%d')" \ + --latest=false \ -F output.txt fi @@ -352,7 +354,18 @@ jobs: echo 'MAIN (real) release' git tag -a $releaseName -m "Here be changelog" git push origin $releaseName - gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag + + # do not tag as latest when alpha or beta. + if [[ "$version" == *alpha* ]] || [[ "$version" == *beta* ]]; then + echo 'Mark alpha or beta as NOT the latest.' + gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag --latest=false + fi + + # tag as latest when NOT alpha or beta. + if [[ "$version" != *alpha* ]] && [[ "$version" != *beta* ]]; then + echo 'Mark prod as the latest.' + gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag + fi # add archive files to release gh release upload $releaseName $zipName From 4a185639b98ac8328059f12e86f3762b62aec3a1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 3 Jan 2025 04:32:51 +0100 Subject: [PATCH 2/4] Fix removal of all piggy banks. --- app/Repositories/PiggyBank/PiggyBankRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index b7f500ca1e..dad2c21c7f 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -53,7 +53,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function destroyAll(): void { Log::channel('audit')->info('Delete all piggy banks through destroyAll'); - $this->user->piggyBanks()->delete(); + + PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->delete(); } public function findPiggyBank(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank From c17f2efca6a2f831f5e3581674a87e1799f79267 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 3 Jan 2025 04:36:41 +0100 Subject: [PATCH 3/4] Fix missing variables. --- app/Http/Controllers/Chart/BudgetController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 2ae6db7a63..e017f322c1 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -397,6 +397,9 @@ class BudgetController extends Controller foreach ($journals as $journal) { $key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']); $amount = $journal['amount']; + $symbol = $journal['currency_symbol']; + $code = $journal['currency_code']; + $name = $journal['currency_name']; // if convert to native, use the native things, unless it's the foreign amount which is in the native currency. if ($this->convertToNative && $journal['currency_id'] !== $this->defaultCurrency->id && $journal['foreign_currency_id'] !== $this->defaultCurrency->id) { From ae80fd8578a28733b75217a2030a5b4302e78d6b Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 3 Jan 2025 04:51:42 +0100 Subject: [PATCH 4/4] Fix test cases. --- tests/integration/Api/Autocomplete/CurrencyControllerTest.php | 4 ++-- tests/integration/TestCase.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php index 577dd57ac7..6b61462192 100644 --- a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php +++ b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php @@ -100,7 +100,7 @@ final class CurrencyControllerTest extends TestCase $this->actingAs($user); // create test data - $this->createTestCurrencies(10, true); + $this->createTestCurrencies(9, true); // test API $response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']); @@ -134,7 +134,7 @@ final class CurrencyControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']); $response->assertStatus(200); $response->assertHeader('Content-Type', 'application/json'); - $response->assertJsonCount(0); + $response->assertJsonCount(1); // always connects to EUR. } public function testGivenAuthenticatedRequestWhenCallingTheCurrenciesEndpointWithQueryThenReturnsCurrenciesWithLimit(): void diff --git a/tests/integration/TestCase.php b/tests/integration/TestCase.php index 6be5deece5..a1feed229d 100644 --- a/tests/integration/TestCase.php +++ b/tests/integration/TestCase.php @@ -23,8 +23,10 @@ declare(strict_types=1); namespace Tests\integration; +use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; use FireflyIII\User; +use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Tests\integration\Traits\CollectsValues; @@ -35,8 +37,10 @@ abstract class TestCase extends BaseTestCase { use CollectsValues; use CreatesApplication; + use RefreshDatabase; protected const MAX_ITERATIONS = 2; + protected $seed = true; public function dateRangeProvider(): array {