[server] Bugfix: Filter result of device-data action by reading type

pull/26/head
Starbeamrainbowlabs 4 years ago
parent 25ab294d1c
commit ee6cf4a86e
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 3
      logic/Repositories/MariaDBMeasurementDataRepository.php

@ -131,6 +131,8 @@ class MariaDBMeasurementDataRepository implements IMeasurementDataRepository {
{$s("table_name_metadata")}.{$s("column_metadata_id")} = {$s("table_name_values")}.{$s("column_values_reading_id")}
WHERE
{$s("table_name_metadata")}.{$s("column_metadata_device_id")} = :device_id AND
{$s("table_name_values")}.{$s("column_values_reading_type")} = :reading_type AND
COALESCE(
{$s("table_name_metadata")}.{$s("column_metadata_recordedon")},
{$s("table_name_metadata")}.{$s("column_metadata_storedon")}
@ -144,6 +146,7 @@ class MariaDBMeasurementDataRepository implements IMeasurementDataRepository {
{$s("table_name_metadata")}.{$s("column_metadata_storedon")}
)) / :average_seconds);", [
"device_id" => $device_id,
"reading_type" => $reading_type,
"start_datetime" => $start->format(\DateTime::ISO8601),
"end_datetime" => $end->format(\DateTime::ISO8601),
"average_seconds" => $average_seconds

Loading…
Cancel
Save