|
@@ -4,6 +4,7 @@ using MathNet.Numerics.Distributions;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Azure.Cosmos;
|
|
|
using StackExchange.Redis;
|
|
|
+using System.Collections.Generic;
|
|
|
using System.Text.Json;
|
|
|
using System.Xml;
|
|
|
using TEAMModelOS.SDK;
|
|
@@ -141,15 +142,17 @@ namespace HTEX.DataETL.Controllers
|
|
|
studentLessonDatas = LessonETLService.GetTaskData(lessonBase, timeLineData, taskDatas, studentLessonDatas, id);
|
|
|
var pickupData = LessonETLService.GetPickupData(lessonBase, timeLineData, studentLessonDatas, id);
|
|
|
studentLessonDatas= pickupData.studentLessonDatas;
|
|
|
-
|
|
|
+ var codeBools= LessonETLService.GetCodeBools(studentLessonDatas);
|
|
|
await System.IO.File.WriteAllTextAsync(Path.Combine(path, $"student-analysis.json"), studentLessonDatas.ToJsonString());
|
|
|
- string jsons = await System.IO.File.ReadAllTextAsync($"{lessonPath}\\analysis\\analysis.json");
|
|
|
- LessonDataAnalysisCluster lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisCluster>();
|
|
|
- var lessonItems = LessonETLService.ProcessStudentDataV2(studentLessonDatas, lessonDataAnalysis);
|
|
|
+ string jsons = await System.IO.File.ReadAllTextAsync($"{lessonPath}\\analysis\\analysis-model.json");
|
|
|
+ LessonDataAnalysisModel lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisModel>();
|
|
|
+
|
|
|
+
|
|
|
+ var studentLessons = LessonETLService.ProcessStudentDataV2(studentLessonDatas, lessonDataAnalysis,codeBools);
|
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
|
var runtimePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
|
xmlDocument.Load($"{runtimePath}\\summary.xml");
|
|
|
- await LessonETLService.ExportToExcelLocal(lessonItems, $"{path}\\analysis.xlsx", xmlDocument);
|
|
|
+ await LessonETLService.ExportToExcelLocal(studentLessons, $"{path}\\analysis.xlsx", xmlDocument);
|
|
|
}
|
|
|
}
|
|
|
return Ok();
|
|
@@ -160,24 +163,24 @@ namespace HTEX.DataETL.Controllers
|
|
|
/// </summary>
|
|
|
/// <param name="json"></param>
|
|
|
/// <returns></returns>
|
|
|
- //[HttpPost("process-fix-history-students")]
|
|
|
- //public async Task<IActionResult> ProcessFixHistoryStudents(JsonElement json)
|
|
|
- //{
|
|
|
- // string? lessonBasePath = _configuration.GetValue<string>("LessonPath");
|
|
|
- // string studentsPath = $"{lessonBasePath}\\students";
|
|
|
- // List<string> studentsPs = FileHelper.ListAllFiles(studentsPath);
|
|
|
- // string? pathLessons = $"{lessonBasePath}\\lessons";
|
|
|
- // List<string> filesLessons = FileHelper.ListAllFiles(pathLessons, "-local.json");
|
|
|
- // int index = 0;
|
|
|
- // foreach (var stu in studentsPs)
|
|
|
- // {
|
|
|
- // string stujson = await System.IO.File.ReadAllTextAsync(stu);
|
|
|
- // var studentSemester = stujson.ToObject<StudentSemesterRecord>();
|
|
|
- // await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code));
|
|
|
- // index++;
|
|
|
- // }
|
|
|
- // return Ok();
|
|
|
- //}
|
|
|
+ [HttpPost("process-fix-history-students")]
|
|
|
+ public async Task<IActionResult> ProcessFixHistoryStudents(JsonElement json)
|
|
|
+ {
|
|
|
+ string? pathAnalysis = $"F:\\lesson-local\\analysis";
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string jsons = await System.IO.File.ReadAllTextAsync($"F:\\lesson-local\\analysis\\analysis-model.json");
|
|
|
+ var s = JsonSerializer.Deserialize<LessonDataAnalysisModel>(jsons);
|
|
|
+ LessonDataAnalysisModel lessonDataAnalysis = JsonDocument.Parse(jsons).RootElement.ToObject<LessonDataAnalysisModel>();
|
|
|
+ var per = LessonETLService.GetPersent(lessonDataAnalysis.irs, 2);
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Console.WriteLine(ex.ToString());
|
|
|
+ }
|
|
|
+ return Ok();
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
@@ -191,13 +194,12 @@ namespace HTEX.DataETL.Controllers
|
|
|
string? lessonBasePath = _configuration.GetValue<string>("LessonPath");
|
|
|
string? pathLessons = $"{lessonBasePath}\\lessons";
|
|
|
string? pathAnalysis = $"{lessonBasePath}\\analysis";
|
|
|
- string jsons = await System.IO.File.ReadAllTextAsync($"{pathAnalysis}\\analysis.json");
|
|
|
- LessonDataAnalysisCluster lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisCluster>();
|
|
|
+ string jsons = await System.IO.File.ReadAllTextAsync($"{pathAnalysis}\\analysis-model.json");
|
|
|
+ LessonDataAnalysisModel lessonDataAnalysis = jsons.ToObject<LessonDataAnalysisModel>();
|
|
|
List<string> filesLessons = FileHelper.ListAllFiles(pathLessons, "-local.json");
|
|
|
var runtimePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
|
xmlDocument.Load($"{runtimePath}\\summary.xml");
|
|
|
- List<StudentSemesterRecord> students = new List<StudentSemesterRecord>();
|
|
|
List<School> schools = new List<School>();
|
|
|
// await Parallel.ForEachAsync(filesLessons, async (fileLesson, _) =>
|
|
|
List<string> localIds = new List<string>();
|
|
@@ -209,9 +211,10 @@ namespace HTEX.DataETL.Controllers
|
|
|
localIds.Add(lessonId);
|
|
|
}
|
|
|
}
|
|
|
- long stime = 1690819200000;//2023-08-01 00:00:00
|
|
|
+ long stime = 1693497600000;//2023-08-01 00:00:00
|
|
|
+ long etime = 1731513599000;//2023-08-01 00:00:00
|
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
|
- .GetList<LessonRecord>($"SELECT value c FROM c where c.startTime>{stime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", $"LessonRecord-ydzt");
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<={etime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ");
|
|
|
List<string> ignore = new List<string>() { "PgJump", "PgRcv", "PgAdd" };
|
|
|
int index = 0;
|
|
|
if (resultSchool.list.IsNotEmpty())
|
|
@@ -219,45 +222,89 @@ namespace HTEX.DataETL.Controllers
|
|
|
List<StudentSemesterRecord> studentSemesterRecords= new List<StudentSemesterRecord>();
|
|
|
List<OverallEducation> overallEducations= new List<OverallEducation>();
|
|
|
List<Student> studentsBase = new List<Student>();
|
|
|
-
|
|
|
- await foreach (var item in LessonETLService.GetLessonLocal(resultSchool.list, localIds, _azureStorage, pathLessons))
|
|
|
+ List<LessonLocal>lessonLocals = new List<LessonLocal>();
|
|
|
+ await Parallel.ForEachAsync(resultSchool.list, async (lessonRecord, cancellationToken) =>
|
|
|
+ {
|
|
|
+ var item = await LessonETLService.GetLessonLocal(lessonRecord,localIds,_azureStorage,pathLessons);
|
|
|
+ lessonLocals.Add(item);
|
|
|
+ index++;
|
|
|
+ });
|
|
|
+
|
|
|
+ var schoolGroup = lessonLocals.Where(x=>!string.IsNullOrWhiteSpace(x.lessonRecord?.school)).GroupBy(x => x.lessonRecord?.school).Select(x => new { key=x.Key ,list=x.ToList()});
|
|
|
+ string schoolSql = $"select value c from c where c.id in ({string.Join(",", schoolGroup.Select(x => $"'{x.key}'"))})";
|
|
|
+ var schoolResults= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<School>(schoolSql, "Base");
|
|
|
+ if (schoolResults.list.IsNotEmpty())
|
|
|
{
|
|
|
- string yearMonthPath = DateTimeOffset.FromUnixTimeMilliseconds(item.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
- if (item.lessonBase!=null && item.lessonBase.student!=null)
|
|
|
+ schools.AddRange(schoolResults.list);
|
|
|
+ }
|
|
|
+ foreach (var group in schoolGroup)
|
|
|
+ {
|
|
|
+ var studentIds = group.list.SelectMany(x => x.studentLessonDatas).Where(x=>!string.IsNullOrWhiteSpace(x.id)).Select(x => x.id).Distinct();
|
|
|
+ string studentSql = $"select value c from c where c.id in ({string.Join(",", studentIds.Select(x => $"'{x}'"))})";
|
|
|
+ var studentResults= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<Student>(studentSql, $"Base-{group.key}");
|
|
|
+ if (studentResults.list.IsNotEmpty())
|
|
|
{
|
|
|
- TechCount techCount = new TechCount
|
|
|
- {
|
|
|
- lessonId=item.lessonRecord?.id,
|
|
|
- examCount = item.examDatas.Count,
|
|
|
- taskCount = item.taskDatas.Count,
|
|
|
- irsCount = item.irsDatas.Count,
|
|
|
- coworkCount = item.coworkDatas.Count,
|
|
|
- smartRatingCount =item.smartRatingDatas.Count,
|
|
|
- timeCount=item.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()
|
|
|
- };
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord.id}-count.json", techCount.ToJsonString());
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
+ studentsBase.AddRange(studentResults.list);
|
|
|
}
|
|
|
- else
|
|
|
+ string studentSemesterRecordSql = $"select value c from c where c.stuid in ({string.Join(",", studentIds.Select(x => $"'{x}'"))}) and c.studyYear>=2023";
|
|
|
+ var studentSemesterRecordResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<StudentSemesterRecord>(studentSemesterRecordSql, $"StudentSemesterRecord-{group.key}");
|
|
|
+ if (studentSemesterRecordResults.list.IsNotEmpty())
|
|
|
{
|
|
|
-
|
|
|
- System.IO.File.Delete($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json");
|
|
|
- System.IO.File.Delete($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-count.json");
|
|
|
+ studentSemesterRecords.AddRange(studentSemesterRecordResults.list);
|
|
|
+ }
|
|
|
+ string overallEducationSql = $"select value c from c where c.studentId in ({string.Join(",", studentIds.Select(x => $"'{x}'"))}) and c.year>=2023";
|
|
|
+ var overallEducationResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<OverallEducation>(overallEducationSql, $"OverallEducation-{group.key}");
|
|
|
+ if (overallEducationResults.list.IsNotEmpty())
|
|
|
+ {
|
|
|
+ overallEducations.AddRange(overallEducationResults.list);
|
|
|
}
|
|
|
- await LessonETLService.DoStudentLessonData(Constant.objectiveTypes, _azureStorage, item, _dingDing, _azureCosmos.GetCosmosClient(), "China", _azureRedis, studentSemesterRecords,overallEducations, lessonDataAnalysis, studentsBase, schools);
|
|
|
- index++;
|
|
|
}
|
|
|
- foreach (var studentSemester in studentSemesterRecords)
|
|
|
+ List<(string id,string owner, List<StudentLessonData> studentLessonData)> studentLessonDatas= new List<(string id, string owner, List<StudentLessonData>)>();
|
|
|
+ List<(string id, string owner, List<StudentLessonItem> studentLessons,List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)> lessonItems = new List<(string id, string owner, List<StudentLessonItem> studentLessons, List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)>();
|
|
|
+ int n = 0;
|
|
|
+ foreach (var item in lessonLocals)
|
|
|
{
|
|
|
- await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code));
|
|
|
+ var studata = await LessonETLService.DoStudentLessonData(Constant.objectiveTypes, _azureStorage, item, _dingDing, _azureCosmos.GetCosmosClient(), "China", _azureRedis, studentSemesterRecords, overallEducations, lessonDataAnalysis, studentsBase, schools);
|
|
|
+ if (studata.codeBools.FindAll(x=>x.value).IsNotEmpty())
|
|
|
+ {
|
|
|
+ string owner = item.lessonRecord.scope.Equals("school") ? item.lessonRecord.school : item.lessonRecord.tmdid;
|
|
|
+ studentLessonDatas.Add((item.lessonRecord.id, owner, studata.studentLessonDatas));
|
|
|
+ lessonItems.Add((item.lessonRecord.id, owner, studata.lessonItems,studata.codeBools,studata.studentLessonDatas));
|
|
|
+ }
|
|
|
+ n++;
|
|
|
}
|
|
|
- foreach (var overallEducation in overallEducations)
|
|
|
+ int p = 0;
|
|
|
+ //XmlDocument xmlDocument = new XmlDocument();
|
|
|
+ //var runtimePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
|
+ //xmlDocument.Load($"{runtimePath}\\summary.xml");
|
|
|
+ await Parallel.ForEachAsync(lessonItems, async (lessonItem, cancellationToken) =>
|
|
|
+ {
|
|
|
+ lessonItem.studentLessons = LessonETLService.ProcessStudentDataV2(lessonItem.studentLessonData, lessonDataAnalysis, lessonItem.codeBools);
|
|
|
+ await LessonETLService.ExportToExcelAzureBlob(lessonItem.studentLessons, _azureStorage, lessonItem.owner, $"{lessonItem.id}/student-analysis.xlsx", xmlDocument);
|
|
|
+ p++;
|
|
|
+ });
|
|
|
+ int s = 0;
|
|
|
+ await Parallel.ForEachAsync(studentLessonDatas, async (studentLessonData, cancellationToken) =>
|
|
|
+ {
|
|
|
+ await _azureStorage.GetBlobContainerClient(studentLessonData.owner).UploadFileByContainer(studentLessonData.studentLessonData.ToJsonString(), "records", $"{studentLessonData.id}/student-analysis.json");
|
|
|
+ s++;
|
|
|
+ });
|
|
|
+
|
|
|
+ int m =0;
|
|
|
+ await Parallel.ForEachAsync(studentSemesterRecords, async (studentSemester, cancellationToken) =>
|
|
|
+ {
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code));
|
|
|
+ m++;
|
|
|
+ });
|
|
|
+ int k = 0;
|
|
|
+ await Parallel.ForEachAsync(overallEducations, async (overallEducation, cancellationToken) =>
|
|
|
{
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(overallEducation, partitionKey: new PartitionKey(overallEducation.code));
|
|
|
- string key = $"OverallEducation:{overallEducation.schoolCode}:{overallEducation.periodId}:{overallEducation.year}:{overallEducation.semesterId}:{overallEducation?.classId}";
|
|
|
- await _azureRedis.GetRedisClient(8).HashSetAsync(key, overallEducation.studentId, overallEducation.ToJsonString());
|
|
|
- await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, new TimeSpan(180 *24, 0, 0));
|
|
|
- }
|
|
|
+ //string key = $"OverallEducation:{overallEducation.schoolCode}:{overallEducation.periodId}:{overallEducation.year}:{overallEducation.semesterId}:{overallEducation?.classId}";
|
|
|
+ //await _azureRedis.GetRedisClient(8).HashSetAsync(key, overallEducation.studentId, overallEducation.ToJsonString());
|
|
|
+ //await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, new TimeSpan(180 *24, 0, 0));
|
|
|
+ k++;
|
|
|
+ });
|
|
|
}
|
|
|
return Ok();
|
|
|
}
|
|
@@ -289,7 +336,7 @@ namespace HTEX.DataETL.Controllers
|
|
|
bool loadLocal = true;
|
|
|
List<LessonDataAnalysisMonth> lessonDataAnalysisMonths = new List<LessonDataAnalysisMonth>();
|
|
|
var filesAnalysis = FileHelper.ListAllFiles(pathAnalysis);
|
|
|
- long stime = 1690819200000;//2023-08-01 00:00:00
|
|
|
+ long stime = 1693497600000;//2023-09-01 00:00:00
|
|
|
foreach (var file in filesAnalysis)
|
|
|
{
|
|
|
//读取每月的数据
|
|
@@ -329,7 +376,7 @@ namespace HTEX.DataETL.Controllers
|
|
|
{
|
|
|
List<LessonRecord> lessonRecords = new List<LessonRecord>();
|
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
|
- .GetList<LessonRecord>($"SELECT value c FROM c where c.startTime>={stime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
|
if (resultSchool.list.IsNotEmpty())
|
|
|
{
|
|
|
newest= resultSchool.list.Max(x => x.startTime);
|
|
@@ -340,7 +387,7 @@ namespace HTEX.DataETL.Controllers
|
|
|
newest=stime;
|
|
|
}
|
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
|
- .GetList<LessonRecord>($"SELECT value c FROM c where c.startTime>={stime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
|
if (resultTeacher.list.IsNotEmpty())
|
|
|
{
|
|
|
long max = resultTeacher.list.Max(x => x.startTime);
|
|
@@ -353,40 +400,46 @@ namespace HTEX.DataETL.Controllers
|
|
|
List<string> ignore = new List<string>() { "PgJump", "PgRcv", "PgAdd" };
|
|
|
if (lessonRecords.IsNotEmpty())
|
|
|
{
|
|
|
-
|
|
|
- await foreach (var item in LessonETLService.GetLessonLocal(lessonRecords, localIds, _azureStorage, pathLessons))
|
|
|
- {
|
|
|
+ await Parallel.ForEachAsync(lessonRecords, async(record, _)=>{
|
|
|
+ LessonLocal item = await LessonETLService.GetLessonLocal(record, localIds, _azureStorage, pathLessons);
|
|
|
string yearMonthPath = DateTimeOffset.FromUnixTimeMilliseconds(item.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
- if (item.lessonBase!=null && item.lessonBase.student!=null)
|
|
|
- {
|
|
|
- TechCount techCount = new TechCount
|
|
|
- {
|
|
|
- lessonId=item.lessonRecord?.id,
|
|
|
- examCount = item.examDatas.Count,
|
|
|
- taskCount = item.taskDatas.Count,
|
|
|
- irsCount = item.irsDatas.Count,
|
|
|
- coworkCount = item.coworkDatas.Count,
|
|
|
- smartRatingCount =item.smartRatingDatas.Count,
|
|
|
- timeCount=item.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()
|
|
|
- };
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord.id}-count.json", techCount.ToJsonString());
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
- }
|
|
|
- else
|
|
|
+ item.lessonRecord.learningCategory= item.lessonBase?.summary?.learningCategory;
|
|
|
+ if (item.lessonRecord.learningCategory == null)
|
|
|
{
|
|
|
|
|
|
- System.IO.File.Delete($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json");
|
|
|
- System.IO.File.Delete($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-count.json");
|
|
|
+ item.lessonRecord.learningCategory = new LearningCategory();
|
|
|
}
|
|
|
- }
|
|
|
+ await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ //await foreach (var item in LessonETLService.GetLessonLocal(lessonRecords, localIds, _azureStorage, pathLessons))
|
|
|
+ // {
|
|
|
+ // string yearMonthPath = DateTimeOffset.FromUnixTimeMilliseconds(item.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
+ // item.lessonRecord.learningCategory= item.lessonBase?.summary?.learningCategory;
|
|
|
+ // if (item.lessonRecord.learningCategory == null)
|
|
|
+ // {
|
|
|
+
|
|
|
+ // item. lessonRecord.learningCategory = new LearningCategory();
|
|
|
+ // }
|
|
|
+ // await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
+ // }
|
|
|
}
|
|
|
List<TechCount> techCounts = new List<TechCount>();
|
|
|
filesLessons = FileHelper.ListAllFiles(pathLessons, "-local.json");
|
|
|
- await foreach (var item in LessonETLService.GetTeachCount(lessonRecords, filesLessons, pathLessons, ignore, Constant.objectiveTypes, _azureStorage, force))
|
|
|
- {
|
|
|
- techCounts.Add(item);
|
|
|
- }
|
|
|
- await LessonETLService.GenAnalysisData(pathAnalysis, newest, techCounts,_azureStorage);
|
|
|
+ //await foreach (var item in LessonETLService.GetTeachCount(_azureCosmos,lessonRecords, filesLessons, pathLessons, ignore, Constant.objectiveTypes, _azureStorage, force))
|
|
|
+ //{
|
|
|
+ // techCounts.Add(item);
|
|
|
+ //}
|
|
|
+
|
|
|
+ await Parallel.ForEachAsync(filesLessons, async (item, _) => {
|
|
|
+ TechCount techCount= await LessonETLService.GetTeachCount(_azureCosmos, item, pathLessons, ignore, Constant.objectiveTypes, _azureStorage, force);
|
|
|
+ if (techCount != null) {
|
|
|
+ techCounts.Add(techCount);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ await LessonETLService.GenAnalysisData(pathAnalysis, newest, techCounts,_azureStorage);
|
|
|
}
|
|
|
return Ok(new { yearMonth });
|
|
|
}
|