diff --git a/BugzillaOutput.class.php b/BugzillaOutput.class.php index c22350d..bb3551c 100644 --- a/BugzillaOutput.class.php +++ b/BugzillaOutput.class.php @@ -81,8 +81,19 @@ protected function setup_template_data() { $this->response->fields = array(); // Set the bug data for the templates - if(isset($this->query->data['bugs']) && count($this->query->data['bugs']) > 0) { - $this->response->bugs = $this->query->data['bugs']; + if(isset($this->query->data['bugs']) && + count($this->query->data['bugs']) > 0) { + $bugs = $this->query->data['bugs']; + // Randomize the bugs, if requested. + if(isset($this->config['randomize'])) { + shuffle($bugs); + } + + // If a limit has been set, use it. + if(isset($this->config['limit'])) { + $bugs = array_slice($bugs, 0, (int)$this->config['limit']); + } + $this->response->bugs = $bugs; } // Set the field data for the templates diff --git a/README.md b/README.md index d2c860b..297a529 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,15 @@ and b) display those columns. ![Screenshot of the above](http://i.imgur.com/p3u7r.png "Screenshot of the above") +You may also limit the total number of results displayed and/or randomize the order of the results: + + + { + "whiteboard": "EasyHack", + "status": "NEW" + } + + Charting ================================