zhouj1203@hotmail.com 1 рік тому
батько
коміт
c1d5e79578
1 змінених файлів з 7 додано та 5 видалено
  1. 7 5
      TEAMModelOS.SDK/Models/Service/StudentService.cs

+ 7 - 5
TEAMModelOS.SDK/Models/Service/StudentService.cs

@@ -54,10 +54,11 @@ namespace TEAMModelOS.SDK
             public string creatorId { get; set; }
             public string scode { get; set; }
             public string type { get; set; }
-            public string examType { get; set; }
+            public Custom examType { get; set; } = new Custom();
 
             public List<ExamSubject> subjects { get; set; } = new List<ExamSubject>();
 
+            public List<string> classIds { get; set; } = new List<string>();
             public List<string> classes { get; set; } = new List<string>();
             public List<string> stuLists { get; set; } = new List<string>();
             public List<string> tchLists { get; set; } = new List<string>();
@@ -91,7 +92,7 @@ namespace TEAMModelOS.SDK
         /// <param name="azureRedis"></param>
         public static async Task<List<StudentActivity>> FindActivity(JsonElement request, string userId, string userScope, List<string> groupListIds, List<string> subjects, string school, List<string> types, AzureCosmosFactory _azureCosmos)
         {
-            string filed = "c.id ,c.code,c.owner,c.pk as type,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
+            string filed = "c.id ,c.code,c.owner,c.pk as type,c.examType,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
             if (string.IsNullOrWhiteSpace(school))
             {
                 if (request.TryGetProperty("school", out JsonElement schooljson))
@@ -147,7 +148,7 @@ namespace TEAMModelOS.SDK
                     subjectJoin = "join s in c.subjects";
                     subjectSQL = $" and  s.id in ({string.Join(",", subjects.Select(z => $"'{z}'"))}) ";
                 }
-                StringBuilder SQL = new StringBuilder($"select distinct {filed} from c {subjectJoin} where c.pk='Exam' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} ");
+                StringBuilder SQL = new StringBuilder($"select distinct {filed} from c {subjectJoin} where c.pk='Exam' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} and c.qamode != 2 ");
                 //获取学校发布的活动
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
@@ -162,7 +163,7 @@ namespace TEAMModelOS.SDK
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.owner='teacher' ");
                     if(resultTeacher.list.Count > 0) {
                         List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultTeacher.list, school, userId, userScope);
-                        datas.AddRange(resultTeacher.list);
+                        datas.AddRange(activity);
                     }
                 }
                    
@@ -348,10 +349,11 @@ namespace TEAMModelOS.SDK
                 creatorId = x.creatorId,
                 subjects = x.subjects,
                 owner = x.owner,
-                classes = x.classes,
+                classIds = x.classIds.Count > 0 ? x.classes : x.stuLists,
                 code = x.code,
                 createTime = x.createTime,
                 qamode = x.qamode,
+                examType = x.examType,
                 //taskStatus = et.Select(c => c[x.id]).FirstOrDefault(),
                 //ext = new Dictionary<string, JsonElement>() { { "type", !string.IsNullOrEmpty(x.examType) ? x.examType.ToJsonString().ToObject<JsonElement>():new JsonElement() },
                             //{ "subjects", x.subjects.ToJsonString().ToObject<JsonElement>() } },