add support to filter build results by date
cover add support to filter build results by date
Victor Huesca (2):
web/funcs.inc.php: add support for filtering by date web/index.php: allow filtering by date
web/funcs.inc.php | 10 ++++++++++ web/index.php | 3 +++ 2 files changed, 13 insertions(+)
Signature · 1 line
2.21.0
PATCH 1/2 web/funcs.inc.php: add support for filtering by date
This patch provides support for filtering by date in the 'bab_format_sql_filter' function. The date can be either a singe value -- in which case it is assumed as a 'from' date -- or an associative array with 'from' and/or 'to' keys defined.
--- web/funcs.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+)
web/funcs.inc.php +10 -0
@@ -44,6 +44,16 @@ function bab_format_sql_filter($db, $filters) return sprintf("%s like %s", $k, $db->quote_smart($v)); else if ($k == "status") return sprintf("%s=%s", $k, $db->quote_smart($status_map[$v])); + elseif ($k == "date") + if (is_array($v)) { + if (isset($v['from'], $v['to'])) + return sprintf("builddate between %s and %s", $db->quote_smart($v['from']), $db->quote_smart($v['to'])); + else if (isset($v['to'])) + return sprintf("builddate<=%s", $db->quote_smart($v['to'])); + else + return sprintf("builddate>=%s", $db->quote_smart($v['from'])); + } else // Assuming the date is a lower-bound + return sprintf("builddate>=%s", $db->quote_smart($v)); else return sprintf("%s=%s", $k, $db->quote_smart($v)); },
Signature · 1 line
2.21.0
PATCH 2/2 web/index.php: allow filtering by date
In reply to Victor HuescaThis patch provide a way to pass a date as part of the filter. This date can be either a single date or a couple 'start and end' dates as an associative array to cover every case:
Example: "date[from]=2019-03-03&date[to]=2019-07-21"
--- web/index.php | 3 +++ 1 file changed, 3 insertions(+)
web/index.php +3 -0
@@ -59,6 +59,9 @@ if (isset($_GET['subarch']) && preg_match("/^[A-Za-z0-9_\+\.\-]*$/", $_GET['suba if (isset ($_GET['submitter'])) $filters["submitter"] = urldecode($_GET['submitter']); +if (isset($_GET['date'])) + $filters["date"] = $_GET['date']; + bab_header("Buildroot tests"); echo "<table>\n";
Signature · 1 line
2.21.0
cover add support to filter build results by date
In reply to Victor HuescaQuoted 3 lines · On Tue, 13 Aug 2019 09:08:20 +0200 Victor Huesca <[email protected]>…
Victor Huesca (2):
web/funcs.inc.php: add support for filtering by date web/index.php: allow filtering by date
Both applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com