mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Last minute fixes in test code and UI
This commit is contained in:
@@ -939,7 +939,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['currency_decimal_places'];
|
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['currency_decimal_places'];
|
||||||
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
||||||
}
|
}
|
||||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
|
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount'] ?? '0');
|
||||||
|
|
||||||
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
|
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
|
||||||
$currencyId = (int)$transaction['foreign_currency_id'];
|
$currencyId = (int)$transaction['foreign_currency_id'];
|
||||||
@@ -952,7 +952,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places'];
|
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places'];
|
||||||
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
||||||
}
|
}
|
||||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount']);
|
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount'] ?? '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ class ImportArrayStorage
|
|||||||
|
|
||||||
// get language of user.
|
// get language of user.
|
||||||
/** @var Preference $pref */
|
/** @var Preference $pref */
|
||||||
$pref = app('preferences')->get('language', config('firefly.default_language', 'en_US'));
|
$pref = app('preferences')->getForUser($importJob->user, 'language', config('firefly.default_language', 'en_US'));
|
||||||
$this->language = $pref->data;
|
$this->language = $pref->data;
|
||||||
|
|
||||||
Log::debug('Constructed ImportArrayStorage()');
|
Log::debug('Constructed ImportArrayStorage()');
|
||||||
|
@@ -326,7 +326,8 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
|
|
||||||
Log::debug(sprintf('Minimum is %s, maximum is %s, difference is %s', $min, $max, $diff));
|
Log::debug(sprintf('Minimum is %s, maximum is %s, difference is %s', $min, $max, $diff));
|
||||||
|
|
||||||
if (0 !== bccomp($diff, '0')) {// for each full coin in tag, add so many points
|
if (0 !== bccomp($diff, '0')) { // for each full coin in tag, add so many points
|
||||||
|
// minus the smallest tag.
|
||||||
$pointsPerCoin = bcdiv($maxPoints, $diff);
|
$pointsPerCoin = bcdiv($maxPoints, $diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +336,8 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$amount = (string)$tag->amount_sum;
|
$amount = (string)$tag->amount_sum;
|
||||||
$amount = '' === $amount ? '0' : $amount;
|
$amount = '' === $amount ? '0' : $amount;
|
||||||
$pointsForTag = bcmul($amount, $pointsPerCoin);
|
$amountMin = bcsub($amount, $min);
|
||||||
|
$pointsForTag = bcmul($amountMin, $pointsPerCoin);
|
||||||
$fontSize = bcadd($minimumFont, $pointsForTag);
|
$fontSize = bcadd($minimumFont, $pointsForTag);
|
||||||
Log::debug(sprintf('Tag "%s": Amount is %s, so points is %s', $tag->tag, $amount, $fontSize));
|
Log::debug(sprintf('Tag "%s": Amount is %s, so points is %s', $tag->tag, $amount, $fontSize));
|
||||||
|
|
||||||
|
@@ -573,7 +573,7 @@ trait PeriodOverview
|
|||||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$return[$currencyId]['amount'] = bcadd($return[$currencyId]['amount'], $journal['amount']);
|
$return[$currencyId]['amount'] = bcadd($return[$currencyId]['amount'], $journal['amount'] ?? '0');
|
||||||
$return[$currencyId]['count']++;
|
$return[$currencyId]['count']++;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -104,7 +104,10 @@ class Preferences
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
if (null === $user) {
|
if (null === $user) {
|
||||||
return $default;
|
$preference = new Preference;
|
||||||
|
$preference->data = $default;
|
||||||
|
|
||||||
|
return $preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getForUser($user, $name, $default);
|
return $this->getForUser($user, $name, $default);
|
||||||
|
@@ -38,12 +38,18 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 30px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="title">Be right back.</div>
|
<div class="title">Whoops</div>
|
||||||
|
<div class="text">There was a fatal error. Please check the log files.</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -164,7 +164,7 @@ class BillControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BillRepositoryInterface::class);
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$transformer = $this->mock(BillTransformer::class);
|
$transformer = $this->mock(BillTransformer::class);
|
||||||
|
$euro = $this->getEuro();
|
||||||
$pref = new Preference;
|
$pref = new Preference;
|
||||||
$pref->data = 50;
|
$pref->data = 50;
|
||||||
Preferences::shouldReceive('get')->withArgs(['listPageSize', 50])->atLeast()->once()->andReturn($pref);
|
Preferences::shouldReceive('get')->withArgs(['listPageSize', 50])->atLeast()->once()->andReturn($pref);
|
||||||
@@ -174,6 +174,10 @@ class BillControllerTest extends TestCase
|
|||||||
$transformer->shouldReceive('transform')->atLeast()->once()->andReturn(
|
$transformer->shouldReceive('transform')->atLeast()->once()->andReturn(
|
||||||
['id' => 5, 'active' => true, 'name' => 'x', 'next_expected_match' => '2018-01-01',
|
['id' => 5, 'active' => true, 'name' => 'x', 'next_expected_match' => '2018-01-01',
|
||||||
'currency' => $this->getEuro(),
|
'currency' => $this->getEuro(),
|
||||||
|
'currency_id' => $euro->id,
|
||||||
|
'currency_code' => $euro->code,
|
||||||
|
'currency_symbol' => $euro->symbol,
|
||||||
|
'currency_decimal_places' => $euro->decimal_places,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ class TagFactoryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFindOrCreateNew(): void
|
public function testFindOrCreateNew(): void
|
||||||
{
|
{
|
||||||
$tag = sprintf('§Some new tag #%d', $this->randomInt());
|
$tag = sprintf('Some new tag %d', $this->randomInt());
|
||||||
/** @var TagFactory $factory */
|
/** @var TagFactory $factory */
|
||||||
$factory = app(TagFactory::class);
|
$factory = app(TagFactory::class);
|
||||||
$factory->setUser($this->user());
|
$factory->setUser($this->user());
|
||||||
|
@@ -79,7 +79,7 @@ class RecurrenceTransformerTest extends TestCase
|
|||||||
$recurrenceRepos->shouldReceive('getXOccurrences')->andReturn($ranges)->atLeast()->once();
|
$recurrenceRepos->shouldReceive('getXOccurrences')->andReturn($ranges)->atLeast()->once();
|
||||||
$factory->shouldReceive('findOrCreate')->atLeast()->once()->withArgs([null,Mockery::any()])->andReturn($category);
|
$factory->shouldReceive('findOrCreate')->atLeast()->once()->withArgs([null,Mockery::any()])->andReturn($category);
|
||||||
$budgetRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($budget);
|
$budgetRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($budget);
|
||||||
$piggyRepos->shouldReceive('findNull')->atLeast()->once()->andReturn($piggy);
|
$piggyRepos->shouldReceive('findNull')->andReturn($piggy);
|
||||||
$billRepos->shouldReceive('find')->andReturn($bill);
|
$billRepos->shouldReceive('find')->andReturn($bill);
|
||||||
|
|
||||||
// basic transformation:
|
// basic transformation:
|
||||||
|
Reference in New Issue
Block a user