Ver código fonte

fix: 智能组卷如果章节已掌握自动生成下一个章节的摸底测试

gwd 1 semana atrás
pai
commit
68cf1b703d

+ 3 - 1
app/Http/Controllers/Api/IntelligentExamController.php

@@ -265,11 +265,13 @@ class IntelligentExamController extends Controller
             $totalScore = array_sum(array_column($questions, 'score'));
 
             // 第二步:保存试卷到数据库(同步)
+            // 【修复】策略可能修改assembleType(如章节智能组卷检测到全部掌握后转为下一章节摸底)
+            $finalAssembleType = ($result !== null && isset($result['assemble_type'])) ? $result['assemble_type'] : $assembleType;
             $paperId = $this->questionBankService->saveExamToDatabase([
                 'paper_name' => $paperName,
                 'student_id' => $data['student_id'],
                 'teacher_id' => $data['teacher_id'] ?? null,
-                'assembleType' => $assembleType,
+                'assembleType' => $finalAssembleType,
                 'difficulty_category' => $difficultyCategory,
                 'total_score' => $totalScore, // 使用计算后的实际总分
                 'questions' => $questions,

+ 1 - 0
app/Services/LearningAnalyticsService.php

@@ -1608,6 +1608,7 @@ class LearningAnalyticsService
                 // 【新增】传递章节摸底和智能组卷的关键字段
                 'diagnostic_chapter_id' => $params['diagnostic_chapter_id'] ?? null,
                 'explanation_kp_codes' => $params['explanation_kp_codes'] ?? null,
+                'assemble_type' => $params['assembleType'] ?? null, // 策略可能修改assembleType(如章节智能→章节摸底)
                 'stats' => [
                     'total_selected' => count($selectedQuestions),
                     'source_questions' => count($allQuestions),