wesmiler 1 tydzień temu
rodzic
commit
a0011fd871
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      app/Services/Api/PaperService.php

+ 4 - 4
app/Services/Api/PaperService.php

@@ -444,9 +444,9 @@ class PaperService extends BaseService
                 $info['last'] = ExamTopicModel::from('exam_topics as a')
                     ->leftJoin('exam_answers_topics as b','b.topic_id','=','a.id')
                     ->where(['a.paper_id'=> $paperId,'a.status'=>1,'a.mark'=>1])
-                    ->where(function($query) use($isError,$paperId){
+                    ->where(function($query) use($isError,$userId){
                         if($isError==1){
-                            $query->where(['b.accurate'=>0])->where('b.id','>', 0);
+                            $query->where(['b.accurate'=>0,'b.user_id'=>$userId])->where('b.id','>', 0);
                         }
                     })
                     ->where('a.sort','>', $sort)
@@ -460,9 +460,9 @@ class PaperService extends BaseService
                 $info['next'] = ExamTopicModel::from('exam_topics as a')
                     ->leftJoin('exam_answers_topics as b','b.topic_id','=','a.id')
                     ->where(['a.paper_id'=> $paperId,'a.status'=>1,'a.mark'=>1])
-                    ->where(function($query) use($isError,$paperId){
+                    ->where(function($query) use($isError,$userId){
                         if($isError==1){
-                            $query->where(['b.accurate'=>0])->where('b.id','>', 0);
+                            $query->where(['b.accurate'=>0,'b.user_id'=>$userId])->where('b.id','>', 0);
                         }
                     })
                     ->where('a.sort','<', $sort)