|
@@ -13,6 +13,16 @@ using System.Threading.Tasks;
|
|
|
using System;
|
|
|
using System.Linq;
|
|
|
using TEAMModelOS.SDK.Models.Service.BI;
|
|
|
+using Azure.Storage.Blobs.Models;
|
|
|
+using System.IO;
|
|
|
+using System.Text;
|
|
|
+using System.Text.Json.Nodes;
|
|
|
+using TEAMModelOS.SDK.Helper.Common.JsonHelper.JsonPath;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.Student;
|
|
|
+using HTEXLib.Helpers.ShapeHelpers;
|
|
|
+using TEAMModelOS.Models.Dto;
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.Common;
|
|
|
|
|
|
namespace TEAMModelOS.FunctionV4
|
|
|
{
|
|
@@ -46,7 +56,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- await BIStats.SetTypeAddStats(client, _dingDing, data.school, "Exam", -1,careDate:data.startTime);//BI统计增/减量
|
|
|
+ await BIStats.SetTypeAddStats(client, _dingDing, data.school, "Exam", -1, careDate: data.startTime);//BI统计增/减量
|
|
|
return;
|
|
|
}
|
|
|
ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(data.id, new Azure.Cosmos.PartitionKey($"{data.code}"));
|
|
@@ -445,7 +455,8 @@ namespace TEAMModelOS.FunctionV4
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static async Task resultStatus(CosmosClient client, List<ExamClassResult> examClassResults) {
|
|
|
+ public static async Task resultStatus(CosmosClient client, List<ExamClassResult> examClassResults)
|
|
|
+ {
|
|
|
List<Task<ItemResponse<ExamClassResult>>> tasks = new();
|
|
|
//结算单科单班的标准差和平均分
|
|
|
foreach (ExamClassResult classResult in examClassResults)
|
|
@@ -478,17 +489,17 @@ namespace TEAMModelOS.FunctionV4
|
|
|
//该学生缺考,历史数据的判定
|
|
|
//if (ans.Count == 0)
|
|
|
//{
|
|
|
- for (int i = 0; i < classResult.studentScores[index].Count; i++)
|
|
|
+ for (int i = 0; i < classResult.studentScores[index].Count; i++)
|
|
|
+ {
|
|
|
+ if (classResult.studentScores[index][i] == -1)
|
|
|
{
|
|
|
- if (classResult.studentScores[index][i] == -1)
|
|
|
- {
|
|
|
- classResult.studentScores[index][i] = 0;
|
|
|
- }
|
|
|
+ classResult.studentScores[index][i] = 0;
|
|
|
}
|
|
|
+ }
|
|
|
/*if (ans.Count == 0)
|
|
|
{
|
|
|
classResult.status[index] = 1;
|
|
|
- } */
|
|
|
+ } */
|
|
|
//}
|
|
|
|
|
|
}
|
|
@@ -513,7 +524,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
if (classResult.studentScores[index][i] == -1)
|
|
|
{
|
|
|
classResult.studentScores[index][i] = 0;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
classResult.status[index] = 1;
|
|
|
}
|
|
@@ -564,9 +575,9 @@ namespace TEAMModelOS.FunctionV4
|
|
|
{
|
|
|
examResults.Add(item);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (examResults.Count > 0)
|
|
|
- {
|
|
|
+ {
|
|
|
//记录某次考试所有学生得分总分
|
|
|
double score = 0;
|
|
|
double allScore = 0;
|
|
@@ -586,8 +597,9 @@ namespace TEAMModelOS.FunctionV4
|
|
|
if (info.id == examResult.examId)
|
|
|
{
|
|
|
//处理缺考的学生
|
|
|
- List<string> stus = examResult.studentIds.Except(losStu).ToList();
|
|
|
- foreach (var id in stus) {
|
|
|
+ List<string> stus = examResult.studentIds.Except(losStu).ToList();
|
|
|
+ foreach (var id in stus)
|
|
|
+ {
|
|
|
int index = examResult.studentIds.IndexOf(id);
|
|
|
score += examResult.studentScores[index].Sum();
|
|
|
}
|
|
@@ -627,13 +639,13 @@ namespace TEAMModelOS.FunctionV4
|
|
|
if (result.studentScores.Count > 0)
|
|
|
{
|
|
|
sc += result.studentScores[result.studentIds.IndexOf(id)].Sum();
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
powSum += Math.Pow(sc - NewsRateScore, 2);
|
|
|
}
|
|
|
info.standard = Math.Round(total > 0 ? Math.Pow(powSum / total, 0.5) : 0, 2);
|
|
|
double NewsRate = allScore > 0 ? Math.Round(NewsRateScore / allScore * 100, 2) : 0;
|
|
|
- double qrate = Math.Round(total > 0 ? qk / total * 100:0, 2);
|
|
|
+ double qrate = Math.Round(total > 0 ? qk / total * 100 : 0, 2);
|
|
|
settlement.rate = NewsRate;
|
|
|
settlement.score = NewsRateScore;
|
|
|
settlement.stus = losStu;
|
|
@@ -668,7 +680,8 @@ namespace TEAMModelOS.FunctionV4
|
|
|
List<string> phs = new();
|
|
|
List<string> pls = new();
|
|
|
//分别获取高分组低分组人员
|
|
|
- foreach (var ph in cdm.SH) {
|
|
|
+ foreach (var ph in cdm.SH)
|
|
|
+ {
|
|
|
phs.Add(er.studentIds[ph.Item1]);
|
|
|
}
|
|
|
foreach (var pl in cdm.SL)
|
|
@@ -729,7 +742,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
{
|
|
|
if (classResult.ans.Count > 0)
|
|
|
{
|
|
|
- optl.Add(classResult.ans[index]);
|
|
|
+ optl.Add(classResult.ans[index]);
|
|
|
PLCount++;
|
|
|
continue;
|
|
|
}
|
|
@@ -1028,7 +1041,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
ph.Add(phCount);
|
|
|
pl.Add(plCount);
|
|
|
double per = classResult.studentIds.Count - lostStu > 0 ? Math.Round(score / (classResult.studentIds.Count - lostStu), 2) : 0;
|
|
|
- persent.Add(allScore > 0 ? Math.Round(per / allScore,2) : 0);
|
|
|
+ persent.Add(allScore > 0 ? Math.Round(per / allScore, 2) : 0);
|
|
|
}
|
|
|
classResult.phc = ph;
|
|
|
classResult.plc = pl;
|
|
@@ -1306,8 +1319,8 @@ namespace TEAMModelOS.FunctionV4
|
|
|
//int count = 0;
|
|
|
foreach (double sc in scores)
|
|
|
{
|
|
|
- newScores.Add(sc > -1 ? sc : 0);
|
|
|
- }
|
|
|
+ newScores.Add(sc > -1 ? sc : 0);
|
|
|
+ }
|
|
|
classSrate += newScores.Sum();
|
|
|
score += newScores.Sum();
|
|
|
result.studentScores.Add(newScores);
|
|
@@ -1373,7 +1386,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
result.record = getMore(info, no, opt);
|
|
|
result.average = result.studentIds.Count - result.lostStus.Count > 0 ? Math.Round(score * 1.0 / (result.studentIds.Count - result.lostStus.Count), 2) : 0;
|
|
|
double stand = 0;
|
|
@@ -1410,7 +1423,57 @@ namespace TEAMModelOS.FunctionV4
|
|
|
result.time = info.startTime;
|
|
|
await examRecordCount(info, subject, _dingDing, no, result, examClassResults, _azureCosmos);
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").UpsertItemAsync(result, new Azure.Cosmos.PartitionKey($"ExamResult-{info.id}"));
|
|
|
-
|
|
|
+ List<ErrorItems> errorItems = new();
|
|
|
+ string sqlqueryText = $"select value(c) from c where c.stuId in ({string.Join(",", result.studentIds.Select(x => $"'{x}'"))})";
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<ErrorItems>(queryText: sqlqueryText, requestOptions: new QueryRequestOptions() {PartitionKey = new PartitionKey("ErrorItems") }))
|
|
|
+ {
|
|
|
+ errorItems.Add(item);
|
|
|
+ }
|
|
|
+ if (errorItems.Count == 0) {
|
|
|
+ // 新增逻辑 收集错题内容
|
|
|
+ BlobDownloadResult index_json = await _azureStorage.GetBlobContainerClient($"{info.school}").GetBlobClient($"{info.papers[no].blob}/index.json").DownloadContentAsync();
|
|
|
+ JObject jo = JObject.Parse(index_json.Content.ToString());
|
|
|
+ JArray array = jo.Value<JArray>("slides");
|
|
|
+ List<string> urls = new();
|
|
|
+ foreach (var ne in array)
|
|
|
+ {
|
|
|
+ urls.Add(ne["url"].ToString());
|
|
|
+ }
|
|
|
+ double[] point = StringHelper.ListTodouble(result.paper.point);
|
|
|
+ double[,] res = StringHelper.ListToDouble(result.studentScores);
|
|
|
+ var cdm = new ClouDASMatrix(res, point);
|
|
|
+ //需要努力的题目
|
|
|
+ var ss = cdm.StriveTopic;
|
|
|
+ int n = 0;
|
|
|
+ List<Task<ItemResponse<ErrorItems>>> task_error = new();
|
|
|
+ foreach (var sIds in result.studentIds)
|
|
|
+ {
|
|
|
+ ErrorItems error = new()
|
|
|
+ {
|
|
|
+ ttl = -1,
|
|
|
+ code = "ErrorItems",
|
|
|
+ id = Guid.NewGuid().ToString(),
|
|
|
+ stuId = sIds,
|
|
|
+ school = info.school,
|
|
|
+ activityId = info.id,
|
|
|
+ subjectId = result.subjectId
|
|
|
+ };
|
|
|
+ //顺序学生错题的索引
|
|
|
+ int[] item_index = ss[n];
|
|
|
+ foreach (var item in item_index)
|
|
|
+ {
|
|
|
+ Items items = new()
|
|
|
+ {
|
|
|
+ id = urls[item-1].Replace(".json", ""),
|
|
|
+ blob = info.papers[no].blob
|
|
|
+ };
|
|
|
+ error.its.Add(items);
|
|
|
+ }
|
|
|
+ n++;
|
|
|
+ task_error.Add(_azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").CreateItemAsync(error, new PartitionKey($"{error.code}")));
|
|
|
+ }
|
|
|
+ await task_error.TaskPage(10);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class Settlement
|