|
@@ -2683,7 +2683,7 @@ WHERE
|
|
$stats['withMeasOn'] = 'N/A';
|
|
$stats['withMeasOn'] = 'N/A';
|
|
$v = $request->input('wmo') ?: date('Y-m-d');
|
|
$v = $request->input('wmo') ?: date('Y-m-d');
|
|
$statQuery = "$commonStatSQL
|
|
$statQuery = "$commonStatSQL
|
|
-(SELECT COUNT(mstat.id) FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at::date = '$v' AND mstat.is_cellular_zero IS FALSE) > 0 AND
|
|
|
|
|
|
+EXISTS (SELECT 1 FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at >= '$v 00:00:00' AND mstat.created_at <= '$v 23:59:59' AND mstat.is_cellular_zero IS FALSE) AND
|
|
" . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "
|
|
" . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "
|
|
";
|
|
";
|
|
$statResult = DB::select($statQuery);
|
|
$statResult = DB::select($statQuery);
|
|
@@ -2692,7 +2692,7 @@ WHERE
|
|
$stats['noMeasOn'] = 'N/A';
|
|
$stats['noMeasOn'] = 'N/A';
|
|
$v = $request->input('nmo') ?: date('Y-m-d');
|
|
$v = $request->input('nmo') ?: date('Y-m-d');
|
|
$statQuery = "$commonStatSQL
|
|
$statQuery = "$commonStatSQL
|
|
-(SELECT COUNT(mstat.id) FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at::date = '$v' AND mstat.is_cellular_zero IS FALSE) = 0 AND
|
|
|
|
|
|
+NOT EXISTS (SELECT 1 FROM measurement mstat WHERE mstat.care_month_id = care_month.id AND mstat.created_at >= '$v 00:00:00' AND mstat.created_at <= '$v 23:59:59' AND mstat.is_cellular_zero IS FALSE) AND
|
|
" . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "
|
|
" . (count($conditions) > 0 ? implode(" AND ", $conditions) : '1') . "
|
|
";
|
|
";
|
|
$statResult = DB::select($statQuery);
|
|
$statResult = DB::select($statQuery);
|