Explorar o código

Merge branch 'feature/exam' into test
合并冲突

guqiang hai 1 día
pai
achega
3344780a2c

+ 1 - 6
src/Hotline.Application/Exam/Service/ExamManages/ExtractRuleService.cs

@@ -211,7 +211,6 @@ namespace Hotline.Application.Exam.Service.ExamManages
             var expression = tagQuestionRequest.GetExpression();
             var questionTagTable = new ExamRepository<ExamQuestionTag>(_uow, _dataPermissionFilterBuilder, _serviceProvider).Queryable().Where(expression);
             var questionTable = new ExamRepository<ExamQuestion>(_uow, _dataPermissionFilterBuilder, _serviceProvider).Queryable();
-
             var queryable = questionTagTable.LeftJoin(questionTable, (t, q) => t.QuestionId == q.Id)
                 .GroupBy((t, q) => new { t.TagId, q.QuestionType })
                 .OrderBy((t, q) => t.TagId)
@@ -219,11 +218,7 @@ namespace Hotline.Application.Exam.Service.ExamManages
                 {
                     TagId = t.TagId,
                     QuestionType = q.QuestionType,
-                    TotalCount = SqlFunc.AggregateCount(new
-                    {
-                        TagId = t.TagId,
-                        QuestionType = q.QuestionType,
-                    })
+                    TotalCount = SqlFunc.AggregateCount(q.Id!=null)
                 });
 
             return await queryable.ToListAsync();

+ 2 - 2
src/Hotline.Application/Exam/Service/TestPapers/TestPaperService.cs

@@ -394,10 +394,10 @@ namespace Hotline.Application.Exam.Service.TestPapers
             var tagQuestionTable = tagQuestionRepository.Queryable().Where(expression);
             var questionTable = quesitonRepository.Queryable().Where(questionExpression);
 
-            var taqQuestions = await tagQuestionTable.LeftJoin(questionTable, (t, q) => t.QuestionId == q.Id)
+            var taqQuestions = await tagQuestionTable.InnerJoin(questionTable, (t, q) => t.QuestionId == q.Id)
                 .Select((t, q) => new TagQuestionCountViewResponse
                 {
-                    TotalCount = SqlFunc.AggregateCount(t.Id)
+                    TotalCount = SqlFunc.AggregateCount(q.Id!=null)
                 })
                 .ToListAsync();