changing the query to only filter by instance id not starts/ends if instance id is set.
This commit is contained in:
parent
d50cdd16c2
commit
0f0958ee6b
|
@ -30,8 +30,6 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
$start = $startDT->format("Y-m-d H:i:s");
|
$start = $startDT->format("Y-m-d H:i:s");
|
||||||
$end = $endDT->format("Y-m-d H:i:s");
|
$end = $endDT->format("Y-m-d H:i:s");
|
||||||
$paramMap["starts"] = $start;
|
|
||||||
$paramMap["ends"] = $end;
|
|
||||||
|
|
||||||
$template = $this->getConfiguredItemTemplate();
|
$template = $this->getConfiguredItemTemplate();
|
||||||
$fields = $template["fields"];
|
$fields = $template["fields"];
|
||||||
|
@ -58,11 +56,25 @@ class Application_Service_HistoryService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//Using the instance_id to filter the data.
|
||||||
|
|
||||||
|
|
||||||
$historyRange = "(".
|
$historyRange = "(".
|
||||||
"SELECT history.starts, history.ends, history.id AS history_id, history.instance_id".
|
"SELECT history.starts, history.ends, history.id AS history_id, history.instance_id".
|
||||||
" FROM cc_playout_history as history".
|
" FROM cc_playout_history as history";
|
||||||
" WHERE history.starts >= :starts and history.starts < :ends".
|
|
||||||
") AS history_range";
|
if (isset($instanceId)) {
|
||||||
|
$historyRange.= " WHERE history.instance_id = :instance";
|
||||||
|
$paramMap["instance"] = $instanceId;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$historyRange.= " WHERE history.starts >= :starts and history.starts < :ends";
|
||||||
|
$paramMap["starts"] = $start;
|
||||||
|
$paramMap["ends"] = $end;
|
||||||
|
}
|
||||||
|
|
||||||
|
$historyRange.= ") AS history_range";
|
||||||
|
|
||||||
$manualMeta = "(".
|
$manualMeta = "(".
|
||||||
"SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
|
"SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
|
||||||
|
@ -174,18 +186,6 @@ class Application_Service_HistoryService
|
||||||
" LEFT JOIN {$filter} USING(history_id)";
|
" LEFT JOIN {$filter} USING(history_id)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
//Using the instance_id to filter the data.
|
|
||||||
|
|
||||||
if (isset($instanceId)) {
|
|
||||||
|
|
||||||
$mainSqlQuery.=
|
|
||||||
" WHERE history_range.instance_id = :instance";
|
|
||||||
|
|
||||||
$paramMap["instance"] = $instanceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
//need to count the total rows to tell Datatables.
|
//need to count the total rows to tell Datatables.
|
||||||
$stmt = $this->con->prepare($mainSqlQuery);
|
$stmt = $this->con->prepare($mainSqlQuery);
|
||||||
|
|
Loading…
Reference in New Issue