Skip to content

Commit b2cc158

Browse files
committed
Fixes filtering of accounts for report graphs.
1 parent 1a38c3c commit b2cc158

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/models/Report.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@ public function getMatchAttribute() {
3333
$reportArr = $this->toArray();
3434
$match = [];
3535
$query = isset($reportArr['query']) ? (array) $reportArr['query'] : null;
36-
$actorArray = [];
3736

3837
if (is_array($query) && count($query) > 0 && !isset($query[0])) {
3938
foreach ($query as $key => $value) {
4039
if (in_array($key, $this->actorQuery)) {
41-
if (is_array($value)) {
42-
$match['$or'][][$key] = ['$in' => $value];
43-
} else {
44-
$match['$or'][][$key] = $value;
40+
foreach ($value as $actor_id) {
41+
if (is_object($actor_id)) {
42+
$object_vars = get_object_vars($actor_id);
43+
$filter = [];
44+
foreach ($object_vars as $var_key => $var_val) {
45+
$filter[$key.'.'.$var_key] = $var_val;
46+
}
47+
$match['$or'][] = $filter;
48+
} else {
49+
$match['$or'][][$key] = $actor_id;
50+
}
4551
}
4652
} else {
4753
if (is_array($value)) {

0 commit comments

Comments
 (0)