close #265 Fixed: Dashboard 'Last 12 months' does not work, 'Custom Range' partially broken

This commit is contained in:
cuneytsenturk
2018-11-05 13:29:55 +03:00
parent 2da5ad838c
commit 9988d49f46
2 changed files with 33 additions and 3 deletions

View File

@ -126,6 +126,7 @@ class Dashboard extends Controller
$start = Date::parse(request('start', $this->today->startOfYear()->format('Y-m-d')));
$end = Date::parse(request('end', $this->today->endOfYear()->format('Y-m-d')));
$period = request('period', 'month');
$range = request('range', 'custom');
$start_month = $start->month;
$end_month = $end->month;
@ -135,6 +136,11 @@ class Dashboard extends Controller
$s = clone $start;
if ($range == 'last_12_months') {
$end_month = 12;
$start_month = 1;
}
for ($j = $end_month; $j >= $start_month; $j--) {
$labels[$end_month - $j] = $s->format('M Y');