Li 2 năm trước cách đây
mục cha
commit
59b3d22a0e

+ 52 - 0
TEAMModelOS/Controllers/OpenApi/Business/BizOverallEducationController.cs

@@ -205,6 +205,58 @@ namespace TEAMModelOS.Controllers
                     lessonRecord.totalInteractPoint = lessonBase.summary.totalInteractPoint;
                     lessonRecord.learningCategory = lessonBase.summary.learningCategory;
                     lessonRecord.source = 1;
+
+                    //计算TP灯
+                    {
+                        int T = -1;
+                        int P = -1;
+                        if (lessonRecord.clientInteractionAverge <= 0)
+                        {
+                            T = 0;
+                        }
+                        else if (lessonRecord.clientInteractionAverge >= 1 && lessonRecord.clientInteractionAverge <= 2)
+                        {
+                            T = 1;
+                        }
+                        else
+                        {
+                            T = 2;
+                        }
+                        //if (lessonRecord.examCount > 0)
+                        //{
+                        //    //有评测次数大于0则P是直接绿灯
+                        //    P = 2;
+                        //}
+                        //else {
+
+                        //}
+
+                        int a = lessonRecord.hitaClientCmpCount;
+                        int b = lessonRecord.pushCount;
+                        int c = lessonRecord.examCount;
+                        switch (true)
+                        {
+                            case bool when T == 0:
+                                P = 0;
+                                break;
+                            case bool when T == 1 || T == 2:
+                                if (a == 0 && b == 0 && c == 0)
+                                {
+                                    P = 0;
+                                }
+                                else if ((a > 0 && b > 0) || (a > 0 && c > 0) || (b > 0 && c > 0))
+                                {
+                                    P = 2;
+                                }
+                                else
+                                {
+                                    P = 1;
+                                }
+                                break;
+                        }
+                        lessonRecord.tLevel = T;
+                        lessonRecord.pLevel = P;
+                    }
                 }
                 if (resLess.Status == 200)
                     lessonRecord = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<LessonRecord>(lessonRecord, lessonRecord.id, new PartitionKey($"{code}"));