mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Clean up code and comments.
This commit is contained in:
@@ -330,6 +330,37 @@ class Navigation
|
||||
return $currentEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's view range and if necessary, corrects the dynamic view
|
||||
* range to a normal range.
|
||||
* @param bool $correct
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getViewRange(bool $correct): string
|
||||
{
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||
if (!$correct) {
|
||||
return $range;
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
return $range;
|
||||
case 'last7':
|
||||
return '1W';
|
||||
case 'last30':
|
||||
case 'MTD':
|
||||
return '1M';
|
||||
case 'last90':
|
||||
case 'QTD':
|
||||
return '3M';
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
return '1Y';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
@@ -430,37 +461,6 @@ class Navigation
|
||||
return $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's view range and if necessary, corrects the dynamic view
|
||||
* range to a normal range.
|
||||
* @param bool $correct
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getViewRange(bool $correct): string
|
||||
{
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||
if (!$correct) {
|
||||
return $range;
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
return $range;
|
||||
case 'last7':
|
||||
return '1W';
|
||||
case 'last30':
|
||||
case 'MTD':
|
||||
return '1M';
|
||||
case 'last90':
|
||||
case 'QTD':
|
||||
return '3M';
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
return '1Y';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the date difference between start and end is less than a month, method returns trans(config.month_and_day). If the difference is less than a year,
|
||||
* method returns "config.month". If the date difference is larger, method returns "config.year".
|
||||
|
Reference in New Issue
Block a user