Remove 100 limit on response to events index. Handle there not being a next or prev neighbour.
parent
d62779b1e8
commit
6232cfb8b1
|
@ -42,14 +42,14 @@ class EventsController extends AppController {
|
||||||
require_once __DIR__ .'/../../../includes/Event.php';
|
require_once __DIR__ .'/../../../includes/Event.php';
|
||||||
$allowedMonitors = ($user and $user->unviewableMonitorIds()) ? $user->viewableMonitorIds() : null;
|
$allowedMonitors = ($user and $user->unviewableMonitorIds()) ? $user->viewableMonitorIds() : null;
|
||||||
|
|
||||||
if ( $allowedMonitors ) {
|
if (count($allowedMonitors)) {
|
||||||
$mon_options = array('Event.MonitorId' => $allowedMonitors);
|
$mon_options = array('Event.MonitorId' => $allowedMonitors);
|
||||||
} else {
|
} else {
|
||||||
$mon_options = '';
|
$mon_options = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$named_params = $this->request->params['named'];
|
$named_params = $this->request->params['named'];
|
||||||
if ( $named_params ) {
|
if ($named_params) {
|
||||||
# In 1.35.13 we renamed StartTime and EndTime to StartDateTime and EndDateTime.
|
# In 1.35.13 we renamed StartTime and EndTime to StartDateTime and EndDateTime.
|
||||||
# This hack renames the query string params
|
# This hack renames the query string params
|
||||||
foreach ( $named_params as $k=>$v ) {
|
foreach ( $named_params as $k=>$v ) {
|
||||||
|
@ -78,8 +78,10 @@ class EventsController extends AppController {
|
||||||
// with many event APIs. In future, we can
|
// with many event APIs. In future, we can
|
||||||
// make a nice ZM_API_ITEMS_PER_PAGE for all pagination
|
// make a nice ZM_API_ITEMS_PER_PAGE for all pagination
|
||||||
// API
|
// API
|
||||||
|
// ICON: 2023-11-16: MontageReview now uses API and unless we specifiy a limit in params, there should be no limit
|
||||||
|
// TODO: Implement request based limits.
|
||||||
|
|
||||||
'limit' => '100',
|
# 'limit' => '100',
|
||||||
'order' => array('StartDateTime'),
|
'order' => array('StartDateTime'),
|
||||||
'paramType' => 'querystring',
|
'paramType' => 'querystring',
|
||||||
);
|
);
|
||||||
|
@ -153,8 +155,8 @@ class EventsController extends AppController {
|
||||||
# Get the previous and next events for any monitor
|
# Get the previous and next events for any monitor
|
||||||
$this->Event->id = $id;
|
$this->Event->id = $id;
|
||||||
$event_neighbors = $this->Event->find('neighbors');
|
$event_neighbors = $this->Event->find('neighbors');
|
||||||
$event['Event']['Next'] = $event_neighbors['next']['Event']['Id'];
|
$event['Event']['Next'] = isset($event_neighbors['next']) ? $event_neighbors['next']['Event']['Id'] : 0;
|
||||||
$event['Event']['Prev'] = $event_neighbors['prev']['Event']['Id'];
|
$event['Event']['Prev'] = isset($event_neighbors['prev']) ? $event_neighbors['prev']['Event']['Id'] : 0;
|
||||||
|
|
||||||
$event['Event']['fileExists'] = $this->Event->fileExists($event['Event']);
|
$event['Event']['fileExists'] = $this->Event->fileExists($event['Event']);
|
||||||
$event['Event']['fileSize'] = $this->Event->fileSize($event['Event']);
|
$event['Event']['fileSize'] = $this->Event->fileSize($event['Event']);
|
||||||
|
@ -166,8 +168,8 @@ class EventsController extends AppController {
|
||||||
$event_monitor_neighbors = $this->Event->find('neighbors', array(
|
$event_monitor_neighbors = $this->Event->find('neighbors', array(
|
||||||
'conditions'=>array('Event.MonitorId'=>$event['Event']['MonitorId'])
|
'conditions'=>array('Event.MonitorId'=>$event['Event']['MonitorId'])
|
||||||
));
|
));
|
||||||
$event['Event']['NextOfMonitor'] = $event_monitor_neighbors['next']['Event']['Id'];
|
$event['Event']['NextOfMonitor'] = isset($event_monitor_neighbors['next']) ? $event_monitor_neighbors['next']['Event']['Id'] : 0;
|
||||||
$event['Event']['PrevOfMonitor'] = $event_monitor_neighbors['prev']['Event']['Id'];
|
$event['Event']['PrevOfMonitor'] = isset($event_monitor_neighbors['prev']) ? $event_monitor_neighbors['prev']['Event']['Id'] : 0;
|
||||||
|
|
||||||
$this->loadModel('Frame');
|
$this->loadModel('Frame');
|
||||||
$maxScoreFrame = $this->Frame->findByEventid($id, 'FrameId', array('Score'=>'desc','FrameId'=>'asc'))['Frame'];
|
$maxScoreFrame = $this->Frame->findByEventid($id, 'FrameId', array('Score'=>'desc','FrameId'=>'asc'))['Frame'];
|
||||||
|
@ -335,10 +337,7 @@ class EventsController extends AppController {
|
||||||
}
|
}
|
||||||
array_push($conditions, array("StartDateTime >= DATE_SUB(NOW(), INTERVAL $expr $unit)"));
|
array_push($conditions, array("StartDateTime >= DATE_SUB(NOW(), INTERVAL $expr $unit)"));
|
||||||
$query = $this->Event->find('all', array(
|
$query = $this->Event->find('all', array(
|
||||||
'fields' => array(
|
'fields' => array('MonitorId', 'COUNT(*) AS Count'),
|
||||||
'MonitorId',
|
|
||||||
'COUNT(*) AS Count',
|
|
||||||
),
|
|
||||||
'conditions' => $conditions,
|
'conditions' => $conditions,
|
||||||
'group' => 'MonitorId',
|
'group' => 'MonitorId',
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue