Parcourir la source

feat: 组卷获取题目-只获取合格的题目

gwd il y a 1 semaine
Parent
commit
ead6b8dec7

+ 3 - 1
app/Services/DiagnosticChapterService.php

@@ -484,6 +484,7 @@ class DiagnosticChapterService
         }
 
         $kpCodesWithQuestions = \App\Models\Question::query()
+            ->where('audit_status', 0) // 只获取审核通过的题目
             ->whereIn('kp_code', $kpCodes)
             ->distinct()
             ->pluck('kp_code')
@@ -546,8 +547,9 @@ class DiagnosticChapterService
             'raw_records' => $masteryRecords->toArray(),
         ]);
 
-        // 获取每个知识点的题目数量
+        // 获取每个知识点的题目数量(只统计审核通过的题目)
         $questionCounts = \App\Models\Question::query()
+            ->where('audit_status', 0) // 只获取审核通过的题目
             ->whereIn('kp_code', $kpCodes)
             ->selectRaw('kp_code, COUNT(*) as count')
             ->groupBy('kp_code')

+ 3 - 0
app/Services/LearningAnalyticsService.php

@@ -2982,6 +2982,9 @@ class LearningAnalyticsService
             // 查询同年级其他知识点的题目
             $query = \App\Models\Question::query();
 
+            // 只获取审核通过的题目
+            $query->where('audit_status', 0);
+
             $stageGrade = $this->normalizeQuestionStageGrade($grade);
             if ($stageGrade !== null) {
                 $query->where('grade', $stageGrade);

+ 2 - 1
app/Services/QuestionExpansionService.php

@@ -234,7 +234,8 @@ class QuestionExpansionService
         }
 
         try {
-            $questions = Question::whereIn('kp_code', $kpCodes)
+            $questions = Question::where('audit_status', 0) // 只获取审核通过的题目
+                ->whereIn('kp_code', $kpCodes)
                 ->whereNotIn('id', $excludeQuestionIds)
                 ->select(['id'])
                 ->limit($limit)