|
@@ -498,7 +498,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
System.IO.File.WriteAllText(Path.Combine(pathAnalysis, "analysis.json"), lessonDataAnalysisCluster.ToJsonString());
|
|
|
}
|
|
|
|
|
|
- public static async IAsyncEnumerable<TechCount> GetTeachCount(List<LessonRecord> lessonRecords, List<string> filesLessons, string pathLessons, List<string> ignore, List<string> objectiveTypes, AzureStorageFactory azureStorage,bool force)
|
|
|
+ public static async IAsyncEnumerable<TechCount> GetTeachCount(AzureCosmosFactory azureCosmos,List<LessonRecord> lessonRecords, List<string> filesLessons, string pathLessons, List<string> ignore, List<string> objectiveTypes, AzureStorageFactory azureStorage,bool force)
|
|
|
{
|
|
|
List<TechCount> techCounts = new List<TechCount>();
|
|
|
foreach (var item in filesLessons)
|
|
@@ -535,7 +535,8 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
var pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
studentLessonDatas= pickupData.studentLessonDatas;
|
|
|
var codeBools = LessonETLService.GetCodeBools(studentLessonDatas);
|
|
|
- if (codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
|
+ string yearMonth=DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
+ if (codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
|
{
|
|
|
if (count==null) { count= new TechCount(); }
|
|
|
count.lessonId=item.Split("\\").Last().Replace("-local.json", "");
|
|
@@ -551,7 +552,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
if (lessonLocal.lessonRecord!=null)
|
|
|
{
|
|
|
|
|
|
- count.yearMonth=DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
+ count.yearMonth=yearMonth;
|
|
|
|
|
|
if (lessonLocal?.lessonBase?.summary!=null)
|
|
|
{
|
|
@@ -625,7 +626,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
|
//if (force)
|
|
|
//{
|
|
|
-
|
|
|
+
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
@@ -641,6 +642,28 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lessonLocal.lessonRecord.analysis=-1;
|
|
|
+ if (lessonLocal.lessonRecord.scope.Equals("school"))
|
|
|
+ {
|
|
|
+ await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).UpsertItemAsync(lessonLocal.lessonRecord, new PartitionKey(lessonLocal.lessonRecord.code));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(lessonLocal.lessonRecord, new PartitionKey(lessonLocal.lessonRecord.code));
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ System.IO.File.Delete($"{pathLessons}\\MM{yearMonth}\\{lessonLocal.lessonRecord!.id}-local.json");
|
|
|
+ }
|
|
|
+ catch (Exception ex) { }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ System.IO.File.Delete($"{pathLessons}\\MM{yearMonth}\\{lessonLocal.lessonRecord!.id}-count.json");
|
|
|
+ }
|
|
|
+ catch (Exception ex) { }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (count!=null)
|