Merge pull request #166 from shikorism/fix/exclude-future-checkin-from-stats
グラフ画面で表示するデータ範囲を当月末までに制限
This commit is contained in:
commit
212fad4d66
@ -67,6 +67,8 @@ SQL
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dateUntil = now()->addMonth()->startOfMonth();
|
||||||
|
|
||||||
$groupByDay = Ejaculation::select(DB::raw(
|
$groupByDay = Ejaculation::select(DB::raw(
|
||||||
<<<'SQL'
|
<<<'SQL'
|
||||||
to_char(ejaculated_date, 'YYYY/MM/DD') AS "date",
|
to_char(ejaculated_date, 'YYYY/MM/DD') AS "date",
|
||||||
@ -74,6 +76,7 @@ count(*) AS "count"
|
|||||||
SQL
|
SQL
|
||||||
))
|
))
|
||||||
->where('user_id', $user->id)
|
->where('user_id', $user->id)
|
||||||
|
->where('ejaculated_date', '<', $dateUntil)
|
||||||
->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
||||||
->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
||||||
->get();
|
->get();
|
||||||
@ -85,6 +88,7 @@ count(*) AS "count"
|
|||||||
SQL
|
SQL
|
||||||
))
|
))
|
||||||
->where('user_id', $user->id)
|
->where('user_id', $user->id)
|
||||||
|
->where('ejaculated_date', '<', $dateUntil)
|
||||||
->groupBy(DB::raw("to_char(ejaculated_date, 'HH24')"))
|
->groupBy(DB::raw("to_char(ejaculated_date, 'HH24')"))
|
||||||
->orderBy(DB::raw('1'))
|
->orderBy(DB::raw('1'))
|
||||||
->get();
|
->get();
|
||||||
|
Loading…
Reference in New Issue
Block a user