@@ -20,21 +20,6 @@ class Report extends Eloquent {
2020 'statement.context.instructor.mbox_sha1sum '
2121 ];
2222
23- public function getFilterAttribute () {
24- $ reportArr = $ this ->toArray ();
25- $ filter = [];
26-
27- if (isset ($ reportArr ['query ' ])) $ filter ['filter ' ] = json_encode ($ reportArr ['query ' ]);
28- if (isset ($ reportArr ['since ' ])) {
29- $ filter ['since ' ] = $ this ->constructDate ($ reportArr ['since ' ]);
30- }
31- if (isset ($ reportArr ['until ' ])) {
32- $ filter ['until ' ] = $ this ->constructDate ($ reportArr ['until ' ]);
33- }
34-
35- return $ filter ;
36- }
37-
3823 private function constructOr ($ key , $ value ) {
3924 $ query = [];
4025 foreach ($ value as $ actor_id ) {
@@ -105,11 +90,14 @@ public function getWhereAttribute() {
10590 $ wheres = [];
10691 $ query = isset ($ reportArr ['query ' ]) ? (array ) $ reportArr ['query ' ] : null ;
10792 $ actorArray = [];
93+ $ instructorArray = [];
10894
10995 if (is_array ($ query ) && count ($ query ) > 0 && !isset ($ query [0 ])) {
11096 foreach (array_keys ($ query ) as $ key ) {
11197 if (in_array ($ key , $ this ->actorQuery )) {
11298 array_push ($ actorArray , [$ key , $ query [$ key ]]);
99+ } else if (in_array ($ key , $ this ->instructorQuery )) {
100+ array_push ($ instructorArray , [$ key , $ query [$ key ]]);
113101 } else {
114102 if (is_array ($ query [$ key ])) {
115103 array_push ($ wheres , [$ key , 'in ' , $ query [$ key ]]);
@@ -119,6 +107,7 @@ public function getWhereAttribute() {
119107 }
120108 }
121109 array_push ($ wheres , ['orArray ' , 'or ' , $ actorArray ]);
110+ array_push ($ wheres , ['orArray ' , 'or ' , $ instructorArray ]);
122111 }
123112
124113 $ since = isset ($ reportArr ['since ' ]) ? $ this ->constructDate ($ reportArr ['since ' ]) : null ;
0 commit comments