Restore and fix API tests

This commit is contained in:
James Cole
2025-08-16 14:10:24 +02:00
parent 98db6db1eb
commit f04ed5b8f0
11 changed files with 36 additions and 86 deletions

View File

@@ -464,7 +464,7 @@ class Navigation
$displayFormat = (string) trans('config.month_and_day_js', [], $locale);
$diff = $start->diffInMonths($end, true);
// increment by month (for year)
if ($diff >= 1.0001) {
if ($diff >= 1.0001 && $diff < 12.001) {
$increment = 'addMonth';
$displayFormat = (string) trans('config.month_js');
}
@@ -495,7 +495,7 @@ class Navigation
$format = 'Y-m-d';
$diff = $start->diffInMonths($end, true);
// Log::debug(sprintf('preferredCarbonFormat(%s, %s) = %f', $start->format('Y-m-d'), $end->format('Y-m-d'), $diff));
if ($diff >= 1.001) {
if ($diff >= 1.001 && $diff < 12.001) {
// Log::debug(sprintf('Return Y-m because %s', $diff));
$format = 'Y-m';
}
@@ -566,7 +566,7 @@ class Navigation
{
$locale = app('steam')->getLocale();
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
if ($diff >= 1.001 && $diff < 12.001) {
return (string) trans('config.month_js', [], $locale);
}
@@ -584,7 +584,7 @@ class Navigation
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
if ($diff >= 1.001 && $diff < 12.001) {
return 'endOfMonth';
}
@@ -602,7 +602,7 @@ class Navigation
public function preferredRangeFormat(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
if ($diff >= 1.001 && $diff < 12.001) {
return '1M';
}
@@ -620,7 +620,7 @@ class Navigation
public function preferredSqlFormat(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
if ($diff >= 1.001 && $diff < 12.001) {
return '%Y-%m';
}

View File

@@ -66,7 +66,7 @@ trait UserGroupTrait
if ($user instanceof User) {
$this->user = $user;
if (null === $user->userGroup) {
throw new FireflyException(sprintf('User #%d has no user group.', $user->id));
throw new FireflyException(sprintf('User #%d ("%s") has no user group.', $user->id, $user->email));
}
$this->userGroup = $user->userGroup;