|
@@ -4,6 +4,7 @@ using HTEX.Lib.ETL.Lesson;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Azure.Cosmos;
|
|
using Microsoft.Azure.Cosmos;
|
|
using Microsoft.OData.UriParser;
|
|
using Microsoft.OData.UriParser;
|
|
|
|
+using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text.Json;
|
|
using System.Text.Json;
|
|
@@ -13,6 +14,7 @@ using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Helper.Common.FileHelper;
|
|
using TEAMModelOS.SDK.Helper.Common.FileHelper;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Models;
|
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.BI;
|
|
using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
|
|
using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
|
|
|
|
|
|
namespace HTEX.DataETL.Controllers
|
|
namespace HTEX.DataETL.Controllers
|
|
@@ -27,7 +29,6 @@ namespace HTEX.DataETL.Controllers
|
|
private readonly IConfiguration _configuration;
|
|
private readonly IConfiguration _configuration;
|
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
|
|
|
|
|
- private readonly List<string> objectiveTypes = new List<string>() { "single", "multiple", "sortmultiple", "judge" };
|
|
|
|
public LessonRecordController(ILogger<LessonRecordController> logger, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage
|
|
public LessonRecordController(ILogger<LessonRecordController> logger, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage
|
|
, IConfiguration configuration, IWebHostEnvironment environment)
|
|
, IConfiguration configuration, IWebHostEnvironment environment)
|
|
{
|
|
{
|
|
@@ -129,12 +130,12 @@ namespace HTEX.DataETL.Controllers
|
|
{
|
|
{
|
|
studentLessonDatas = localStudents.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
studentLessonDatas = localStudents.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
studentLessonDatas = LessonETLService.GetIRSData(lessonBase, timeLineData, irsDatas, studentLessonDatas, examDatas, id);
|
|
studentLessonDatas = LessonETLService.GetIRSData(lessonBase, timeLineData, irsDatas, studentLessonDatas, examDatas, id);
|
|
- studentLessonDatas = LessonETLService.GetCoworkData(lessonBase, timeLineData, coworkDatas, studentLessonDatas);
|
|
|
|
- studentLessonDatas = LessonETLService.GetExamData(lessonBase, timeLineData, examDatas, studentLessonDatas, objectiveTypes);
|
|
|
|
|
|
+ studentLessonDatas = LessonETLService.GetCoworkData(lessonBase, timeLineData, coworkDatas, studentLessonDatas,id);
|
|
|
|
+ studentLessonDatas = LessonETLService.GetExamData(lessonBase, timeLineData, examDatas, studentLessonDatas, Constant.objectiveTypes, id);
|
|
studentLessonDatas = LessonETLService.GetSmartRatingData(lessonBase, timeLineData, smartRatingDatas, studentLessonDatas, id);
|
|
studentLessonDatas = LessonETLService.GetSmartRatingData(lessonBase, timeLineData, smartRatingDatas, studentLessonDatas, id);
|
|
- studentLessonDatas = LessonETLService.GetTaskData(lessonBase, timeLineData, taskDatas, studentLessonDatas);
|
|
|
|
|
|
+ studentLessonDatas = LessonETLService.GetTaskData(lessonBase, timeLineData, taskDatas, studentLessonDatas,id);
|
|
await System.IO.File.WriteAllTextAsync(Path.Combine(path, $"student-analysis.json"), studentLessonDatas.ToJsonString());
|
|
await System.IO.File.WriteAllTextAsync(Path.Combine(path, $"student-analysis.json"), studentLessonDatas.ToJsonString());
|
|
- string jsons = await System.IO.File.ReadAllTextAsync($"{lessonPath}\\analysis.json");
|
|
|
|
|
|
+ string jsons = await System.IO.File.ReadAllTextAsync($"{lessonPath}\\analysis\\analysis.json");
|
|
LessonDataAnalysisCluster lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisCluster>();
|
|
LessonDataAnalysisCluster lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisCluster>();
|
|
var lessonItems= LessonETLService.ProcessStudentData(studentLessonDatas, lessonDataAnalysis);
|
|
var lessonItems= LessonETLService.ProcessStudentData(studentLessonDatas, lessonDataAnalysis);
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
@@ -268,15 +269,20 @@ namespace HTEX.DataETL.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<TechCount> techCounts = new List<TechCount>();
|
|
List<TechCount> techCounts = new List<TechCount>();
|
|
- filesLessons = FileHelper.ListAllFiles(pathLessons);
|
|
|
|
- await Parallel.ForEachAsync(filesLessons, async (file, _) => {
|
|
|
|
- await GetTeachCount(file, pathLessons, yearMonth, ignore, techCounts, objectiveTypes, _azureStorage);
|
|
|
|
- });
|
|
|
|
|
|
+ filesLessons = FileHelper.ListAllFiles(pathLessons, "-local.json");
|
|
|
|
+ await foreach (var item in GetTeachCount(lessonRecords, filesLessons, pathLessons, ignore, Constant.objectiveTypes, _azureStorage))
|
|
|
|
+ {
|
|
|
|
+ techCounts.Add(item);
|
|
|
|
+ }
|
|
var yearMonthDatas = techCounts.GroupBy(x => x.yearMonth).Select(x => new { key = x.Key, list = x.ToList() });
|
|
var yearMonthDatas = techCounts.GroupBy(x => x.yearMonth).Select(x => new { key = x.Key, list = x.ToList() });
|
|
// lessonDataAnalysisMonths = new List<LessonDataAnalysisMonth>();
|
|
// lessonDataAnalysisMonths = new List<LessonDataAnalysisMonth>();
|
|
LessonDataAnalysisCluster lessonDataAnalysisCluster = new LessonDataAnalysisCluster();
|
|
LessonDataAnalysisCluster lessonDataAnalysisCluster = new LessonDataAnalysisCluster();
|
|
foreach (var yearMonthData in yearMonthDatas)
|
|
foreach (var yearMonthData in yearMonthDatas)
|
|
{
|
|
{
|
|
|
|
+ if (string.IsNullOrWhiteSpace(yearMonthData.key))
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine(yearMonthData.list.Select(x => x.lessonId).ToJsonString());
|
|
|
|
+ }
|
|
LessonDataAnalysisMonth lessonDataAnalysisMonth= new LessonDataAnalysisMonth() { updateTime= newest, yearMonth= yearMonthData.key };
|
|
LessonDataAnalysisMonth lessonDataAnalysisMonth= new LessonDataAnalysisMonth() { updateTime= newest, yearMonth= yearMonthData.key };
|
|
lessonDataAnalysisMonth.pscore = yearMonthData.list.SelectMany(x => x.pscore).ToList();
|
|
lessonDataAnalysisMonth.pscore = yearMonthData.list.SelectMany(x => x.pscore).ToList();
|
|
lessonDataAnalysisMonth.tscore = yearMonthData.list.SelectMany(x => x.tscore).ToList();
|
|
lessonDataAnalysisMonth.tscore = yearMonthData.list.SelectMany(x => x.tscore).ToList();
|
|
@@ -324,13 +330,13 @@ namespace HTEX.DataETL.Controllers
|
|
|
|
|
|
//标准差偏差N倍,视为异常数据
|
|
//标准差偏差N倍,视为异常数据
|
|
int thresholdMultiplier = 2;
|
|
int thresholdMultiplier = 2;
|
|
- lessonDataAnalysisCluster.pscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.pscore, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.gscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.gscore, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.tscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.tscore, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.irs = LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.irs, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.interactNormal=LessonETLService. CleanDataBySDThreshold(lessonDataAnalysisCluster.interactNormal, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.stuCowork=LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.stuCowork, thresholdMultiplier);
|
|
|
|
- lessonDataAnalysisCluster.groupCowork=LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.groupCowork, thresholdMultiplier);
|
|
|
|
|
|
+ lessonDataAnalysisCluster.pscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.pscore.OrderBy(x => x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.gscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.gscore.OrderBy(x => x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.tscore= LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.tscore.OrderBy(x => x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.irs = LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.irs.OrderBy(x => x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.interactNormal=LessonETLService. CleanDataBySDThreshold(lessonDataAnalysisCluster.interactNormal.OrderBy(x => x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.stuCowork=LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.stuCowork.OrderBy(x=>x), thresholdMultiplier);
|
|
|
|
+ lessonDataAnalysisCluster.groupCowork=LessonETLService.CleanDataBySDThreshold(lessonDataAnalysisCluster.groupCowork.OrderBy(x => x), thresholdMultiplier);
|
|
List<KeyValuePair<double, List<int>>> clustersDataInteract = new();
|
|
List<KeyValuePair<double, List<int>>> clustersDataInteract = new();
|
|
var clusterInteract = KMeansService.KMeans(lessonDataAnalysisCluster.interactNormal.Select(x => (int)x).OrderBy(x => x));
|
|
var clusterInteract = KMeansService.KMeans(lessonDataAnalysisCluster.interactNormal.Select(x => (int)x).OrderBy(x => x));
|
|
//foreach (var item in clusterInteract)
|
|
//foreach (var item in clusterInteract)
|
|
@@ -347,113 +353,149 @@ namespace HTEX.DataETL.Controllers
|
|
return Ok(new { yearMonth });
|
|
return Ok(new { yearMonth });
|
|
}
|
|
}
|
|
|
|
|
|
- private static async Task GetTeachCount(string item, string pathLessons, HashSet<string> yearMonth, List<string> ignore, List<TechCount> techCounts,List<string> objectiveTypes,AzureStorageFactory azureStorage)
|
|
|
|
|
|
+ private static async IAsyncEnumerable<TechCount> GetTeachCount(List<LessonRecord> lessonRecords,List<string> filesLessons, string pathLessons, List<string> ignore, List<string> objectiveTypes,AzureStorageFactory azureStorage)
|
|
{
|
|
{
|
|
- if (item.EndsWith("-local.json"))
|
|
|
|
|
|
+ foreach (var item in filesLessons)
|
|
{
|
|
{
|
|
- string localjson = await System.IO.File.ReadAllTextAsync(item);
|
|
|
|
- var lessonLocal = localjson.ToObject<LessonLocal>();
|
|
|
|
- TechCount count = new TechCount();
|
|
|
|
- count.lessonId=item.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
- count.examCount= lessonLocal.examDatas.Count;
|
|
|
|
- count.taskCount= lessonLocal.taskDatas.Count;
|
|
|
|
- count.irsCount= lessonLocal.irsDatas.Count;
|
|
|
|
- count.interactNormalCount=count.irsCount;
|
|
|
|
- count.coworkCount= lessonLocal.coworkDatas.Count;
|
|
|
|
- count.smartRatingCount= lessonLocal.smartRatingDatas.Count;
|
|
|
|
- count.timeCount=lessonLocal.sokratesDatas.Where(x => !ignore.Contains(x.Event) && !x.Event.Contains("End", StringComparison.OrdinalIgnoreCase)).GroupBy(x => x.Event).Select(x => new CodeLong() { code=x.Key, value= x.ToList().Count }).ToList();
|
|
|
|
- if (lessonLocal.lessonRecord!=null)
|
|
|
|
|
|
+ if (item.EndsWith("-local.json"))
|
|
{
|
|
{
|
|
- count.yearMonth=DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
|
- yearMonth.Add(count.yearMonth);
|
|
|
|
- if (lessonLocal?.lessonBase?.summary!=null)
|
|
|
|
- {
|
|
|
|
- count.smartRatingCountBase=lessonLocal.lessonBase.summary.smartRatingCount;
|
|
|
|
- count.irsCountBase=lessonLocal.lessonBase.summary.interactionCount;
|
|
|
|
- count.taskCountBase=lessonLocal.lessonBase.summary.collateTaskCount;
|
|
|
|
- count.coworkCountBase=lessonLocal.lessonBase.summary.coworkTaskCount;
|
|
|
|
- count.examCountBase=lessonLocal.lessonBase.summary.examCount;
|
|
|
|
- count.interactNormalCountBase= count.interactNormalCount;
|
|
|
|
- }
|
|
|
|
- if (lessonLocal?.lessonBase?.report?.clientSummaryList!=null)
|
|
|
|
|
|
+ TechCount count = null;
|
|
|
|
+
|
|
|
|
+ string lessonId = item.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
+ string countFile = item.Replace("-local.json", "-count.json");
|
|
|
|
+ if (System.IO.File.Exists(countFile))
|
|
{
|
|
{
|
|
- count.pscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.score>0).Select(x => x.score);
|
|
|
|
- count.gscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.groupScore>0).Select(x => x.groupScore);
|
|
|
|
- count.tscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.interactScore>0).Select(x => x.interactScore);
|
|
|
|
|
|
+ if (System.IO.File.Exists(countFile))
|
|
|
|
+ {
|
|
|
|
+ string contjson = await System.IO.File.ReadAllTextAsync(countFile);
|
|
|
|
+ count = contjson.ToObject<TechCount>();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- ///处理学生数据
|
|
|
|
|
|
+ if (string.IsNullOrWhiteSpace(count?.yearMonth))
|
|
{
|
|
{
|
|
- List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
|
|
- studentLessonDatas = LessonETLService.GetIRSData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.irsDatas, studentLessonDatas, lessonLocal.examDatas, item);
|
|
|
|
- studentLessonDatas = LessonETLService.GetCoworkData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.coworkDatas, studentLessonDatas);
|
|
|
|
- studentLessonDatas = LessonETLService.GetExamData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.examDatas, studentLessonDatas, objectiveTypes);
|
|
|
|
- studentLessonDatas = LessonETLService.GetSmartRatingData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.smartRatingDatas, studentLessonDatas, item);
|
|
|
|
- studentLessonDatas = LessonETLService.GetTaskData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.taskDatas, studentLessonDatas);
|
|
|
|
- // var techCount = techCounts.Find(x => !string.IsNullOrWhiteSpace(x.lessonId) && !string.IsNullOrWhiteSpace(lessonLocal?.lessonRecord?.id) && x.lessonId.Equals(lessonLocal.lessonRecord.id));
|
|
|
|
- int sumUpload = 0;
|
|
|
|
- int taskCount = 0;
|
|
|
|
- int maxUpload = 0;
|
|
|
|
- //HashSet<string> pickUp = new HashSet<string>();
|
|
|
|
- foreach (var stu in studentLessonDatas)
|
|
|
|
|
|
+ string localjson = await System.IO.File.ReadAllTextAsync(item);
|
|
|
|
+ var lessonLocal = localjson.ToObject<LessonLocal>();
|
|
|
|
+ count = new TechCount();
|
|
|
|
+ count.lessonId=item.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
+ count.examCount= lessonLocal.examDatas.Count;
|
|
|
|
+ count.taskCount= lessonLocal.taskDatas.Count;
|
|
|
|
+ count.irsCount= lessonLocal.irsDatas.Count;
|
|
|
|
+ count.interactNormalCount=count.irsCount;
|
|
|
|
+ count.coworkCount= lessonLocal.coworkDatas.Count;
|
|
|
|
+ count.smartRatingCount= lessonLocal.smartRatingDatas.Count;
|
|
|
|
+ count.timeCount=lessonLocal.sokratesDatas.Where(x => !ignore.Contains(x.Event) && !x.Event.Contains("End", StringComparison.OrdinalIgnoreCase)).GroupBy(x => x.Event).Select(x => new CodeLong() { code=x.Key, value= x.ToList().Count }).ToList();
|
|
|
|
+
|
|
|
|
+ if (string.IsNullOrWhiteSpace("636725021468921856"))
|
|
|
|
+ {
|
|
|
|
+ int d = 1;
|
|
|
|
+ }
|
|
|
|
+ if (lessonLocal.lessonRecord!=null)
|
|
{
|
|
{
|
|
- var countS = stu.taskRecord.itemRecords.Where(x => x.optCount>0);
|
|
|
|
- if (countS.Count()>0)
|
|
|
|
- {
|
|
|
|
- int stuUploadmax = stu.taskRecord.itemRecords.Where(x => x.optCount>0).Max(x => x.optCount);
|
|
|
|
- if (stuUploadmax> maxUpload)
|
|
|
|
- {
|
|
|
|
- maxUpload=stuUploadmax;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- int stuUpload = stu.taskRecord.itemRecords.Where(x => x.optCount>0).Sum(x => x.optCount);
|
|
|
|
|
|
|
|
- sumUpload+=stuUpload;
|
|
|
|
- if (stu.taskRecord.itemRecords.Count()> taskCount)
|
|
|
|
|
|
+ count.yearMonth=DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
|
+
|
|
|
|
+ if (lessonLocal?.lessonBase?.summary!=null)
|
|
{
|
|
{
|
|
- taskCount=stu.taskRecord.itemRecords.Count();
|
|
|
|
|
|
+ count.smartRatingCountBase=lessonLocal.lessonBase.summary.smartRatingCount;
|
|
|
|
+ count.irsCountBase=lessonLocal.lessonBase.summary.interactionCount;
|
|
|
|
+ count.taskCountBase=lessonLocal.lessonBase.summary.collateTaskCount;
|
|
|
|
+ count.coworkCountBase=lessonLocal.lessonBase.summary.coworkTaskCount;
|
|
|
|
+ count.examCountBase=lessonLocal.lessonBase.summary.examCount;
|
|
|
|
+ count.interactNormalCountBase= count.interactNormalCount;
|
|
}
|
|
}
|
|
- var stu_scores = stu.coworkRecord.itemRecords.Where(x => x.itemScore>0).Select(x => x.itemScore);
|
|
|
|
- if (stu_scores!=null && stu_scores.Count()>0)
|
|
|
|
|
|
+ if (lessonLocal?.lessonBase?.report?.clientSummaryList!=null)
|
|
{
|
|
{
|
|
- count.stuCowork.AddRange(stu_scores);
|
|
|
|
|
|
+ count.pscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.score>0).Select(x => x.score);
|
|
|
|
+ count.gscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.groupScore>0).Select(x => x.groupScore);
|
|
|
|
+ count.tscore= lessonLocal.lessonBase.report.clientSummaryList.Where(x => x.interactScore>0).Select(x => x.interactScore);
|
|
}
|
|
}
|
|
- var grp_scores = stu.group_coworkScore.Where(x => x>0);
|
|
|
|
- if (grp_scores!=null && grp_scores.Count()>0)
|
|
|
|
|
|
+ ///处理学生数据
|
|
{
|
|
{
|
|
- count.groupCowork.AddRange(grp_scores);
|
|
|
|
|
|
+ List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
|
|
+ studentLessonDatas = LessonETLService.GetIRSData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.irsDatas, studentLessonDatas, lessonLocal.examDatas, lessonLocal.lessonRecord.id);
|
|
|
|
+ studentLessonDatas = LessonETLService.GetCoworkData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.coworkDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
+ studentLessonDatas = LessonETLService.GetExamData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.examDatas, studentLessonDatas, objectiveTypes, lessonLocal.lessonRecord.id);
|
|
|
|
+ studentLessonDatas = LessonETLService.GetSmartRatingData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.smartRatingDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
+ studentLessonDatas = LessonETLService.GetTaskData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.taskDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
+ // var techCount = techCounts.Find(x => !string.IsNullOrWhiteSpace(x.lessonId) && !string.IsNullOrWhiteSpace(lessonLocal?.lessonRecord?.id) && x.lessonId.Equals(lessonLocal.lessonRecord.id));
|
|
|
|
+ int sumUpload = 0;
|
|
|
|
+ int taskCount = 0;
|
|
|
|
+ int maxUpload = 0;
|
|
|
|
+ //HashSet<string> pickUp = new HashSet<string>();
|
|
|
|
+ foreach (var stu in studentLessonDatas)
|
|
|
|
+ {
|
|
|
|
+ var countS = stu.taskRecord.itemRecords.Where(x => x.optCount>0);
|
|
|
|
+ if (countS.Count()>0)
|
|
|
|
+ {
|
|
|
|
+ int stuUploadmax = stu.taskRecord.itemRecords.Where(x => x.optCount>0).Max(x => x.optCount);
|
|
|
|
+ if (stuUploadmax> maxUpload)
|
|
|
|
+ {
|
|
|
|
+ maxUpload=stuUploadmax;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int stuUpload = stu.taskRecord.itemRecords.Where(x => x.optCount>0).Sum(x => x.optCount);
|
|
|
|
+
|
|
|
|
+ sumUpload+=stuUpload;
|
|
|
|
+ if (stu.taskRecord.itemRecords.Count()> taskCount)
|
|
|
|
+ {
|
|
|
|
+ taskCount=stu.taskRecord.itemRecords.Count();
|
|
|
|
+ }
|
|
|
|
+ var stu_scores = stu.coworkRecord.itemRecords.Where(x => x.itemScore>0).Select(x => x.itemScore);
|
|
|
|
+ if (stu_scores!=null && stu_scores.Count()>0)
|
|
|
|
+ {
|
|
|
|
+ count.stuCowork.AddRange(stu_scores);
|
|
|
|
+ }
|
|
|
|
+ var grp_scores = stu.group_coworkScore.Where(x => x>0);
|
|
|
|
+ if (grp_scores!=null && grp_scores.Count()>0)
|
|
|
|
+ {
|
|
|
|
+ count.groupCowork.AddRange(grp_scores);
|
|
|
|
+ }
|
|
|
|
+ //if (stu.pickups.IsNotEmpty())
|
|
|
|
+ //{
|
|
|
|
+ // foreach (var pickup in stu.pickups)
|
|
|
|
+ // {
|
|
|
|
+ // pickUp.Add(pickup);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ if (studentLessonDatas.Count>0&& taskCount>0 && maxUpload>0)
|
|
|
|
+ {
|
|
|
|
+ var avgUpload = sumUpload*1.0/(studentLessonDatas.Count *taskCount);
|
|
|
|
+ count.upload.Add(new List<double>() { avgUpload, maxUpload });
|
|
|
|
+ }
|
|
|
|
+ //if (pickUp.Count>0)
|
|
|
|
+ //{
|
|
|
|
+ // count.pickup.Add(pickUp.ToList());
|
|
|
|
+ //}
|
|
|
|
+ string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
|
|
+ // if (!azureStorage.GetBlobContainerClient(owner).GetBlobClient($"records/{lessonLocal.lessonRecord.id}/student-analysis.json").Exists())
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // if (!System.IO.File.Exists($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-stu.json"))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (lessonRecords.FindAll(x => x.id.Equals(lessonLocal.lessonRecord.id)).IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-stu.json", studentLessonDatas.ToJsonString());
|
|
|
|
+ await azureStorage.GetBlobContainerClient(owner).UploadFileByContainer(studentLessonDatas.ToJsonString(), "records", $"{lessonLocal.lessonRecord.id}/student-analysis.json");
|
|
|
|
+ await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //if (stu.pickups.IsNotEmpty())
|
|
|
|
- //{
|
|
|
|
- // foreach (var pickup in stu.pickups)
|
|
|
|
- // {
|
|
|
|
- // pickUp.Add(pickup);
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- }
|
|
|
|
- if (studentLessonDatas.Count>0&& taskCount>0 && maxUpload>0)
|
|
|
|
- {
|
|
|
|
- var avgUpload = sumUpload*1.0/(studentLessonDatas.Count *taskCount);
|
|
|
|
- count.upload.Add(new List<double>() { avgUpload, maxUpload });
|
|
|
|
- }
|
|
|
|
- //if (pickUp.Count>0)
|
|
|
|
- //{
|
|
|
|
- // count.pickup.Add(pickUp.ToList());
|
|
|
|
- //}
|
|
|
|
- string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
|
|
- if (!azureStorage.GetBlobContainerClient(owner).GetBlobClient($"records/{lessonLocal.lessonRecord.id}/student-analysis.json").Exists())
|
|
|
|
- {
|
|
|
|
- await azureStorage.GetBlobContainerClient(owner).UploadFileByContainer(studentLessonDatas.ToJsonString(), "records", $"{lessonLocal.lessonRecord.id}/student-analysis.json");
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if (!System.IO.File.Exists($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-stu.json"))
|
|
|
|
- {
|
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-stu.json", studentLessonDatas.ToJsonString());
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
|
|
- techCounts.Add(count);
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (count!=null)
|
|
|
|
+ {
|
|
|
|
+ yield return count;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|