fix
This commit is contained in:
@@ -184,7 +184,8 @@ public function authStats(Request $request)
|
|||||||
$daily = $base()
|
$daily = $base()
|
||||||
->selectRaw('DATE(created_at) as date')
|
->selectRaw('DATE(created_at) as date')
|
||||||
->selectRaw('count(*) as total')
|
->selectRaw('count(*) as total')
|
||||||
->selectRaw('sum(sms_sent) as sms')
|
// Counted with a CASE rather than sum(sms_sent) — Postgres has no sum(boolean)
|
||||||
|
->selectRaw('sum(case when sms_sent then 1 else 0 end) as sms')
|
||||||
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_sent", [AuthLog::EVENT_OTP_SENT])
|
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_sent", [AuthLog::EVENT_OTP_SENT])
|
||||||
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_verified", [AuthLog::EVENT_OTP_VERIFIED])
|
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_verified", [AuthLog::EVENT_OTP_VERIFIED])
|
||||||
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_failed", [AuthLog::EVENT_OTP_FAILED])
|
->selectRaw("sum(case when event = ? then 1 else 0 end) as otp_failed", [AuthLog::EVENT_OTP_FAILED])
|
||||||
@@ -204,7 +205,7 @@ public function authStats(Request $request)
|
|||||||
$byPackage = $base()
|
$byPackage = $base()
|
||||||
->whereNotNull('package_name')
|
->whereNotNull('package_name')
|
||||||
->selectRaw('package_name')
|
->selectRaw('package_name')
|
||||||
->selectRaw('sum(sms_sent) as sms')
|
->selectRaw('sum(case when sms_sent then 1 else 0 end) as sms')
|
||||||
->selectRaw("sum(case when event in (?, ?, ?) then 1 else 0 end) as logins", [
|
->selectRaw("sum(case when event in (?, ?, ?) then 1 else 0 end) as logins", [
|
||||||
AuthLog::EVENT_OTP_VERIFIED,
|
AuthLog::EVENT_OTP_VERIFIED,
|
||||||
AuthLog::EVENT_LOGIN,
|
AuthLog::EVENT_LOGIN,
|
||||||
|
|||||||
Reference in New Issue
Block a user