zj 2 years ago
parent
commit
6e4c764b07

+ 5 - 9
TEAMModelOS.FunctionV4/CosmosDB/TriggerArt.cs

@@ -112,17 +112,13 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
                             List<StuActivity> tmdActivities = new List<StuActivity>();
                             List<StuActivity> tchActivities = new List<StuActivity>();
                             List<string> sub = new();
-/*                            if (art.targets.Count > 0)
+                            if (art.subjects.Count > 0)
                             {
-                                foreach (var course in art.targets)
-                                {
-                                    var info = course.ToObject<List<string>>();
-                                    if (info.Count > 1)
-                                    {
-                                        sub.Add(info[0]);
-                                    }
+                                foreach (var course in art.subjects)
+                                {                                 
+                                        sub.Add(course.id);
                                 }
-                            }*/
+                            }
                             if (tmds.IsNotEmpty())
                             {
                                 tmds.ForEach(x =>

+ 4 - 14
TEAMModelOS/Controllers/Common/ArtController.cs

@@ -198,7 +198,7 @@ namespace TEAMModelOS.Controllers.Common
                              }*/
                             foreach (var acs in info.task) {
                                 if (!string.IsNullOrEmpty(acs.acId)) {
-                                    if (acs.type.Equals("exam"))
+                                    if (acs.type == 1)
                                     {
                                         Azure.Response response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(acs.acId, new PartitionKey($"Exam-{code}"));
                                         if (response.Status == 200)
@@ -207,18 +207,8 @@ namespace TEAMModelOS.Controllers.Common
                                             data.status = 404;
                                             await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(data, data.id, new PartitionKey($"Exam-{code}"));
                                         }
-                                    }
-                                    if (acs.type.Equals("survey"))
-                                    {
-                                        Azure.Response response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(acs.acId, new PartitionKey($"Survey-{code}"));
-                                        if (response.Status == 200)
-                                        {
-                                            Survey data = JsonDocument.Parse(response.Content).RootElement.Deserialize<Survey>();
-                                            data.status = 404;
-                                            await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(data, data.id, new PartitionKey($"Survey-{code}"));
-                                        }
-                                    }
-                                    if (acs.type.Equals("homework"))
+                                    }                                    
+                                    if (acs.type == 2)
                                     {
                                         Azure.Response response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(acs.acId, new PartitionKey($"Homework-{code}"));
                                         if (response.Status == 200)
@@ -390,7 +380,7 @@ namespace TEAMModelOS.Controllers.Common
                     {
                         foreach (var acs in tt.task)
                         {
-                            if (acs.type.Equals("exam"))
+                            if (acs.type == 1)
                             {
                                 var response = await client.GetContainer("TEAMModelOS", "Student").ReadItemStreamAsync(acs.acId, new PartitionKey($"Activity-{school}-{userid}"));
                                 if (response.Status == 200)