Skip to content

Commit b6bf037

Browse files
author
daniel-abbey
committed
Merge pull request #698 from flipace/develop
Fixed filtering of statements with "between" values
2 parents 294a955 + 56f1d1b commit b6bf037

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

app/models/Report.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ public function getMatchAttribute() {
5656
$instructorMatch['$or'][] = $this->constructOr($key, $value);
5757
} else {
5858
if (is_array($value)) {
59-
$match[$key] = ['$in' => $value];
59+
if($value[0] != '<>')
60+
{
61+
$match[$key] = ['$in' => $value];
62+
}
63+
else
64+
{
65+
$match[$key] = ['$lte' => $value[2], '$gte' => $value[1]];
66+
}
6067
} else {
6168
$match[$key] = $value;
6269
}
@@ -100,7 +107,14 @@ public function getWhereAttribute() {
100107
array_push($instructorArray, [$key, $query[$key]]);
101108
} else {
102109
if (is_array($query[$key])) {
103-
array_push($wheres, [$key, 'in', $query[$key]]);
110+
if($query[$key][0] != '<>')
111+
{
112+
array_push($wheres, [$key, 'in', $query[$key]]);
113+
}
114+
else
115+
{
116+
array_push($wheres, [$key, 'between', $query[$key][1], $query[$key][2]]);
117+
}
104118
} else {
105119
array_push($wheres, [$key, '=', $query[$key]]);
106120
}

0 commit comments

Comments
 (0)