Forráskód Böngészése

修改数据结构。

CrazyIter_Bin 3 éve
szülő
commit
0eff4749ce

+ 4 - 11
TEAMModelOS.SDK/Models/Cosmos/Student/HomeworkRecord.cs

@@ -26,25 +26,18 @@ namespace TEAMModelOS.SDK.Models
         /// <summary>
         /// 作业内容
         /// </summary>
-        public Content content { get; set; } 
+        ///public Content content { get; set; } 
         /// <summary>
         /// 教师评语
         /// </summary>
         public List<HomeworkComment> comments { get; set; } = new List<HomeworkComment>();
-    }
-    /// <summary>
-    /// 作业内容
-    /// </summary>
-    public class Content {
-        /// <summary>
-        /// 作答记录
-        /// </summary>
-        public List<List<string>> answers { get; set; } = new List<List<string>>();
         /// <summary>
         ///  其他模式url 及name
         /// </summary>
-        public List<Attachment> resource { get; set; } = new List<Attachment>();
+        public List<Attachment> content { get; set; } = new List<Attachment>();
+        public int submitCount { get; set; } = 0;
     }
+    
     /// <summary>
     /// 作业评论
     /// </summary>

+ 4 - 2
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -450,7 +450,7 @@ namespace TEAMModelOS.Controllers.Learn
                         {
                             partitionKey = $"HomeworkRecord-{school}-{userid}";
                         }
-                        Content content = _content.ToObject<Content>();
+                        List<Attachment> content = _content.ToObject<List<Attachment>>();
                         int taskStatus = -1;
                         byte msgid = 0;
                         if (content != null)
@@ -460,6 +460,7 @@ namespace TEAMModelOS.Controllers.Learn
                             {
                                 HomeworkRecord record = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<HomeworkRecord>($"{_id}", new PartitionKey(partitionKey));
                                 record.content = content;
+                                record.submitCount += 1;
                                 await client.GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<HomeworkRecord>(record, $"{_id}", new PartitionKey(partitionKey));
                                 taskStatus = 1;
                                 msgid = 1;
@@ -477,7 +478,8 @@ namespace TEAMModelOS.Controllers.Learn
                                         content = content,
                                         pk = "HomeworkRecord",
                                         ttl = -1,
-                                        time = now
+                                        time = now,
+                                        submitCount = 1
                                     };
                                     record = await client.GetContainer(Constant.TEAMModelOS, tbname).CreateItemAsync<HomeworkRecord>(record, new PartitionKey(partitionKey));
                                     taskStatus = 1;