mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-23 06:33:00 +00:00
api/device-info: drastically optimise by removing a redundant JOIN
....why we didn't remove it before, I have no idea.
This commit is contained in:
parent
5b724a9766
commit
3dc7b58e6e
2 changed files with 3 additions and 7 deletions
|
@ -11,7 +11,10 @@ This is the changelog for the air quality web interface and its associated HTTP
|
||||||
|
|
||||||
|
|
||||||
## v0.14
|
## v0.14
|
||||||
|
- Remove the heatmap background overlay :-(
|
||||||
|
- Colour device markers based on the latest reading
|
||||||
- [API] Optimise `list-reading-types` action, which necessitated a database schema update and the removal of the `count` property on returned objects
|
- [API] Optimise `list-reading-types` action, which necessitated a database schema update and the removal of the `count` property on returned objects
|
||||||
|
- [API] Drastically optimise `device-info` by removing a redundant JOIN
|
||||||
|
|
||||||
|
|
||||||
## v0.13.6
|
## v0.13.6
|
||||||
|
|
|
@ -108,11 +108,6 @@ class MariaDBDeviceRepository implements IDeviceRepository {
|
||||||
$s = $this->get_static;
|
$s = $this->get_static;
|
||||||
$o = $this->get_static_extra;
|
$o = $this->get_static_extra;
|
||||||
|
|
||||||
$data_repo_class = MariaDBMeasurementDataRepository::class;
|
|
||||||
$data_repo_table_meta = $o($data_repo_class, "table_name_metadata");
|
|
||||||
$data_repo_col_datetime = "$data_repo_table_meta.{$o($data_repo_class, "column_metadata_datetime")}";
|
|
||||||
$data_repo_col_device_id = "$data_repo_table_meta.{$o($data_repo_class, "column_metadata_device_id")}";
|
|
||||||
|
|
||||||
$query_result = $this->database->query(
|
$query_result = $this->database->query(
|
||||||
"SELECT
|
"SELECT
|
||||||
{$s("table_name")}.{$s("column_device_id")} AS id,
|
{$s("table_name")}.{$s("column_device_id")} AS id,
|
||||||
|
@ -125,8 +120,6 @@ class MariaDBDeviceRepository implements IDeviceRepository {
|
||||||
FROM {$s("table_name")}
|
FROM {$s("table_name")}
|
||||||
JOIN {$s("table_name_type")} ON
|
JOIN {$s("table_name_type")} ON
|
||||||
{$s("table_name")}.{$s("column_device_type")} = {$s("table_name_type")}.{$s("column_type_id")}
|
{$s("table_name")}.{$s("column_device_type")} = {$s("table_name_type")}.{$s("column_type_id")}
|
||||||
JOIN $data_repo_table_meta ON
|
|
||||||
$data_repo_col_device_id = {$s("table_name")}.{$s("column_device_id")}
|
|
||||||
WHERE {$s("table_name")}.{$s("column_device_id")} = :device_id
|
WHERE {$s("table_name")}.{$s("column_device_id")} = :device_id
|
||||||
AND {$s("table_name")}.{$s("column_visible")} != 0;", [
|
AND {$s("table_name")}.{$s("column_visible")} != 0;", [
|
||||||
"device_id" => $device_id
|
"device_id" => $device_id
|
||||||
|
|
Loading…
Reference in a new issue