|
@@ -37,41 +37,41 @@ namespace HTEX.Lib.ETL.Lesson
|
|
public class LessonETLService
|
|
public class LessonETLService
|
|
{
|
|
{
|
|
|
|
|
|
- public static async Task<List<LessonLocal>> FixLocalData(List<string> localIds, AzureCosmosFactory _azureCosmos, AzureStorageFactory _azureStorage, string pathLessons,long stime,long etime)
|
|
|
|
|
|
+ public static async Task<List<LessonLocal>> FixLocalData(List<string> localIds, AzureCosmosFactory _azureCosmos, AzureStorageFactory _azureStorage, string pathLessons, long stime, long etime)
|
|
{
|
|
{
|
|
- if (etime<=1693497600000)
|
|
|
|
|
|
+ if (etime<=1693497600000)
|
|
{
|
|
{
|
|
etime= DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
|
etime= DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
|
}
|
|
}
|
|
-
|
|
|
|
- List<string> dbids= new List<string>();
|
|
|
|
|
|
+
|
|
|
|
+ List<string> dbids = new List<string>();
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
- .GetList<string>($"SELECT value c.id 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' ", null);
|
|
|
|
|
|
+ .GetList<string>($"SELECT value c.id FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<{etime} and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
if (resultSchool.list.IsNotEmpty())
|
|
if (resultSchool.list.IsNotEmpty())
|
|
{
|
|
{
|
|
dbids.AddRange(resultSchool.list);
|
|
dbids.AddRange(resultSchool.list);
|
|
}
|
|
}
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
- .GetList<string>($"SELECT value c.id 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' ", "LessonRecord");
|
|
|
|
|
|
+ .GetList<string>($"SELECT value c.id FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<{etime} and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", "LessonRecord");
|
|
if (resultTeacher.list.IsNotEmpty())
|
|
if (resultTeacher.list.IsNotEmpty())
|
|
{
|
|
{
|
|
dbids.AddRange(resultTeacher.list);
|
|
dbids.AddRange(resultTeacher.list);
|
|
}
|
|
}
|
|
- var newIds= dbids.Except(localIds);
|
|
|
|
- List<LessonRecord> list=new List<LessonRecord>();
|
|
|
|
- if (newIds!=null && newIds.Count()>0)
|
|
|
|
|
|
+ var newIds = dbids.Except(localIds);
|
|
|
|
+ List<LessonRecord> list = new List<LessonRecord>();
|
|
|
|
+ if (newIds!=null && newIds.Count()>0)
|
|
{
|
|
{
|
|
var resultSchoolLessons = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
var resultSchoolLessons = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
- .GetList<LessonRecord>($"SELECT value c.id FROM c where c.id in ({string.Join(",",newIds.Select(x=>$"'{x}'"))}) and ( 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' ", null);
|
|
|
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where c.id in ({string.Join(",", newIds.Select(x => $"'{x}'"))}) and ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<{etime} and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", null);
|
|
if (resultSchoolLessons.list.IsNotEmpty())
|
|
if (resultSchoolLessons.list.IsNotEmpty())
|
|
{
|
|
{
|
|
list.AddRange(resultSchoolLessons.list);
|
|
list.AddRange(resultSchoolLessons.list);
|
|
newIds= newIds.Except(resultSchoolLessons.list.Select(x => x.id));
|
|
newIds= newIds.Except(resultSchoolLessons.list.Select(x => x.id));
|
|
}
|
|
}
|
|
- if (newIds!=null && newIds.Count()>0)
|
|
|
|
|
|
+ if (newIds!=null && newIds.Count()>0)
|
|
{
|
|
{
|
|
var resultTeacherLessons = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
var resultTeacherLessons = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
- .GetList<LessonRecord>($"SELECT value c.id FROM c where c.id in ({string.Join(",", newIds.Select(x => $"'{x}'"))}) and ( 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' ", "LessonRecord");
|
|
|
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where c.id in ({string.Join(",", newIds.Select(x => $"'{x}'"))}) and ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<{etime} and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ", "LessonRecord");
|
|
if (resultTeacherLessons.list.IsNotEmpty())
|
|
if (resultTeacherLessons.list.IsNotEmpty())
|
|
{
|
|
{
|
|
list.AddRange(resultTeacherLessons.list);
|
|
list.AddRange(resultTeacherLessons.list);
|
|
@@ -79,18 +79,32 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<LessonLocal> lessonLocals = new List<LessonLocal>();
|
|
List<LessonLocal> lessonLocals = new List<LessonLocal>();
|
|
- foreach (var record in list)
|
|
|
|
|
|
+ foreach (var record in list)
|
|
{
|
|
{
|
|
- var item = await LessonETLService.GetLessonLocal(record, localIds, _azureStorage, pathLessons);
|
|
|
|
- string yearMonthPath = DateTimeOffset.FromUnixTimeMilliseconds(item.lessonRecord.startTime).ToString("yyyyMM");
|
|
|
|
- item.lessonRecord.learningCategory= item.lessonBase?.summary?.learningCategory;
|
|
|
|
- if (item.lessonRecord.learningCategory == null)
|
|
|
|
|
|
+ LessonLocal item = await LessonETLService.GetLessonLocal(record, localIds, _azureStorage, pathLessons);
|
|
|
|
+ if (item.lessonBase!=null && item.lessonBase.student.IsNotEmpty())
|
|
{
|
|
{
|
|
|
|
+ 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();
|
|
|
|
|
|
+ item.lessonRecord.learningCategory = new LearningCategory();
|
|
|
|
+ }
|
|
|
|
+ await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
|
+ lessonLocals.Add(item);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ record.analysis=-1;
|
|
|
|
+ if (record.scope.Equals("school"))
|
|
|
|
+ {
|
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).UpsertItemAsync(record, new PartitionKey(record.code));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(record, new PartitionKey(record.code));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{item.lessonRecord!.id}-local.json", item.ToJsonString());
|
|
|
|
- lessonLocals.Add(item);
|
|
|
|
}
|
|
}
|
|
return lessonLocals;
|
|
return lessonLocals;
|
|
}
|
|
}
|
|
@@ -113,7 +127,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
// This should not happen if all weights sum up to 1
|
|
// This should not happen if all weights sum up to 1
|
|
return items[items.Count - 1].Value;
|
|
return items[items.Count - 1].Value;
|
|
}
|
|
}
|
|
- public static List<CodeBool> GetCodeBools (List<StudentLessonData> studentLessonDatas) {
|
|
|
|
|
|
+ public static List<CodeBool> GetCodeBools(List<StudentLessonData> studentLessonDatas) {
|
|
List<CodeBool> codeBools = new List<CodeBool>() {
|
|
List<CodeBool> codeBools = new List<CodeBool>() {
|
|
new CodeBool { code="hd",value=false },//互动
|
|
new CodeBool { code="hd",value=false },//互动
|
|
new CodeBool { code="pc",value=false },//评测
|
|
new CodeBool { code="pc",value=false },//评测
|
|
@@ -170,7 +184,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
codeBools.Find(x => x.code.Equals("xzxz"))!.value=true;
|
|
codeBools.Find(x => x.code.Equals("xzxz"))!.value=true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (studentLessonData.pickups.FindAll(x => x.Contains("grp", StringComparison.OrdinalIgnoreCase)).IsNotEmpty())
|
|
|
|
|
|
+ if (studentLessonData.pickups.FindAll(x => x.Contains("grp", StringComparison.OrdinalIgnoreCase)).IsNotEmpty())
|
|
{
|
|
{
|
|
codeBools.Find(x => x.code.Equals("xztr"))!.value=true;
|
|
codeBools.Find(x => x.code.Equals("xztr"))!.value=true;
|
|
}
|
|
}
|
|
@@ -189,20 +203,14 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="lessonLocal"></param>
|
|
/// <param name="lessonLocal"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static (List<StudentLessonData> studentLessonDatas, List<StudentLessonItem> lessonItems, List<CodeBool> codeBools)
|
|
|
|
- DoStudentLessonDataV2(List<string> objectiveTypes, LessonLocal lessonLocal, string location, List<StudentSemesterRecord> studentSemesterRecords, List<OverallEducation> overallEducations,
|
|
|
|
|
|
+ public static (List<StudentLessonData> studentLessonDatas, List<StudentLessonItem> lessonItems, List<CodeBool> codeBools)
|
|
|
|
+ DoStudentLessonDataV2(List<string> objectiveTypes, LessonLocal lessonLocal, string location, List<StudentSemesterRecord> studentSemesterRecords, List<OverallEducation> overallEducations,
|
|
LessonDataAnalysisModel lessonDataAnalysis, List<Student> studentsBase, List<School> schools)
|
|
LessonDataAnalysisModel lessonDataAnalysis, List<Student> studentsBase, List<School> schools)
|
|
{
|
|
{
|
|
- List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
|
|
- studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
|
|
- 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 pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
- studentLessonDatas= pickupData.studentLessonDatas;
|
|
|
|
- var codeBools = GetCodeBools(studentLessonDatas);
|
|
|
|
|
|
+
|
|
|
|
+ var studata = GenStudentLessonData(lessonLocal, objectiveTypes);
|
|
|
|
+ var codeBools = studata.codeBools;
|
|
|
|
+ List<StudentLessonData> studentLessonDatas = studata.studentLessonDatas;
|
|
List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
|
|
List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
|
|
string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
if (codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
if (codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
@@ -225,7 +233,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
StudentSemesterRecord studentSemester = studentSemesterRecords.Find(x => x.id.Equals($"{pre_id}-{studentLessonData.id}") && x.code.Equals(code));
|
|
StudentSemesterRecord studentSemester = studentSemesterRecords.Find(x => x.id.Equals($"{pre_id}-{studentLessonData.id}") && x.code.Equals(code));
|
|
if (studentSemester==null)
|
|
if (studentSemester==null)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
studentSemester= new StudentSemesterRecord
|
|
studentSemester= new StudentSemesterRecord
|
|
{
|
|
{
|
|
id= $"{pre_id}-{studentLessonData.id}",
|
|
id= $"{pre_id}-{studentLessonData.id}",
|
|
@@ -238,7 +246,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
period= period?.id,
|
|
period= period?.id,
|
|
pk="StudentSemesterRecord"
|
|
pk="StudentSemesterRecord"
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
studentSemesterRecords.Add(studentSemester);
|
|
studentSemesterRecords.Add(studentSemester);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -315,7 +323,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
string oid = $"{semester.studyYear}-{semester.currSemester.id}-{studentSemester.stuid}";
|
|
string oid = $"{semester.studyYear}-{semester.currSemester.id}-{studentSemester.stuid}";
|
|
string ocode = $"OverallEducation-{school.id}";
|
|
string ocode = $"OverallEducation-{school.id}";
|
|
|
|
|
|
@@ -374,13 +382,14 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- var lesData= overallEducation.les.Find(x => x.id.Equals(lessonLocal.lessonRecord.id));
|
|
|
|
|
|
+ overallEducation.lessonScore.RemoveAll(x => x.lessonId.Equals(lessonLocal.lessonRecord.id));
|
|
|
|
+ var lesData = overallEducation.les.Find(x => x.id.Equals(lessonLocal.lessonRecord.id));
|
|
if (lesData== null)
|
|
if (lesData== null)
|
|
{
|
|
{
|
|
overallEducation.les.Add(new StuLesson { id=lessonLocal.lessonRecord.id, attend=0, time = lessonLocal.lessonRecord.startTime });
|
|
overallEducation.les.Add(new StuLesson { id=lessonLocal.lessonRecord.id, attend=0, time = lessonLocal.lessonRecord.startTime });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -390,17 +399,17 @@ namespace HTEX.Lib.ETL.Lesson
|
|
return (studentLessonDatas, lessonItems, codeBools);
|
|
return (studentLessonDatas, lessonItems, codeBools);
|
|
}
|
|
}
|
|
|
|
|
|
- public static async Task GenAnalysisData(string pathAnalysis, long newest, List<TechCount> techCounts,AzureStorageFactory azureStorage)
|
|
|
|
|
|
+ public static async Task GenAnalysisData(string pathAnalysis, long newest, List<TechCount> techCounts, AzureStorageFactory azureStorage)
|
|
{
|
|
{
|
|
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());
|
|
|
|
- }
|
|
|
|
|
|
+ //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();
|
|
@@ -410,7 +419,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
lessonDataAnalysisMonth.task = yearMonthData.list.Where(x => x.taskCount > 0).Select(x => (double)x.taskCount).ToList();
|
|
lessonDataAnalysisMonth.task = yearMonthData.list.Where(x => x.taskCount > 0).Select(x => (double)x.taskCount).ToList();
|
|
lessonDataAnalysisMonth.stuCowork=yearMonthData.list.SelectMany(x => x.stuCowork).ToList();
|
|
lessonDataAnalysisMonth.stuCowork=yearMonthData.list.SelectMany(x => x.stuCowork).ToList();
|
|
lessonDataAnalysisMonth.groupCowork=yearMonthData.list.SelectMany(x => x.groupCowork).ToList();
|
|
lessonDataAnalysisMonth.groupCowork=yearMonthData.list.SelectMany(x => x.groupCowork).ToList();
|
|
- lessonDataAnalysisMonth.pickup= yearMonthData.list.Where(x => x.pickup.Count()>0).Select(x=>x.pickup).ToList();
|
|
|
|
|
|
+ lessonDataAnalysisMonth.pickup= yearMonthData.list.Where(x => x.pickup.Count()>0).Select(x => x.pickup).ToList();
|
|
System.IO.File.WriteAllText(Path.Combine(pathAnalysis, $"{yearMonthData.key}-m-analysis.json"), lessonDataAnalysisMonth.ToJsonString());
|
|
System.IO.File.WriteAllText(Path.Combine(pathAnalysis, $"{yearMonthData.key}-m-analysis.json"), lessonDataAnalysisMonth.ToJsonString());
|
|
// lessonDataAnalysisMonths.Add( lessonDataAnalysisMonth);
|
|
// lessonDataAnalysisMonths.Add( lessonDataAnalysisMonth);
|
|
if (lessonDataAnalysisMonth.task.IsNotEmpty())
|
|
if (lessonDataAnalysisMonth.task.IsNotEmpty())
|
|
@@ -518,7 +527,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
//await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(lessonDataAnalysisCluster.ToJsonString(), "lesson", $"analysis/analysis.json");
|
|
//await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(lessonDataAnalysisCluster.ToJsonString(), "lesson", $"analysis/analysis.json");
|
|
//System.IO.File.WriteAllText(Path.Combine(pathAnalysis, "analysis.json"), lessonDataAnalysisCluster.ToJsonString());
|
|
//System.IO.File.WriteAllText(Path.Combine(pathAnalysis, "analysis.json"), lessonDataAnalysisCluster.ToJsonString());
|
|
LessonDataAnalysisModel analysisModel = new LessonDataAnalysisModel();
|
|
LessonDataAnalysisModel analysisModel = new LessonDataAnalysisModel();
|
|
- analysisModel.task= lessonDataAnalysisCluster.task.GroupBy(x =>Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
|
|
|
|
+ analysisModel.task= lessonDataAnalysisCluster.task.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.irs= lessonDataAnalysisCluster.irs.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.irs= lessonDataAnalysisCluster.irs.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.interactNormal= lessonDataAnalysisCluster.interactNormal.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.interactNormal= lessonDataAnalysisCluster.interactNormal.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.pscore= lessonDataAnalysisCluster.pscore.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
analysisModel.pscore= lessonDataAnalysisCluster.pscore.GroupBy(x => Math.Ceiling(x)).Select(x => new KeyValuePair<double, int>(x.Key, x.ToList().Count)).ToList();
|
|
@@ -535,9 +544,9 @@ namespace HTEX.Lib.ETL.Lesson
|
|
await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(analysisModel.ToJsonString(), "lesson", $"analysis/analysis-model.json");
|
|
await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(analysisModel.ToJsonString(), "lesson", $"analysis/analysis-model.json");
|
|
System.IO.File.WriteAllText(Path.Combine(pathAnalysis, "analysis-model.json"), analysisModel.ToJsonString());
|
|
System.IO.File.WriteAllText(Path.Combine(pathAnalysis, "analysis-model.json"), analysisModel.ToJsonString());
|
|
}
|
|
}
|
|
- public static async Task<TechCount> GenTeachCount(LessonLocal lessonLocal, AzureStorageFactory azureStorage, List<string> objectiveTypes, List<string> ignore,string pathLessons,AzureCosmosFactory azureCosmos)
|
|
|
|
|
|
+ public static async Task<TechCount> GenTeachCount(LessonLocal lessonLocal, AzureStorageFactory azureStorage, List<string> objectiveTypes, List<string> ignore, string pathLessons, AzureCosmosFactory azureCosmos)
|
|
{
|
|
{
|
|
- var data = GenStudentLessonData(lessonLocal,objectiveTypes);
|
|
|
|
|
|
+ var data = GenStudentLessonData(lessonLocal, objectiveTypes);
|
|
string yearMonth = DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
string yearMonth = DateTimeOffset.FromUnixTimeMilliseconds(lessonLocal.lessonRecord.startTime).ToString("yyyyMM");
|
|
if (data.codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
if (data.codeBools.FindAll(x => x.value).IsNotEmpty())
|
|
{
|
|
{
|
|
@@ -624,6 +633,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -649,9 +659,9 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
catch (Exception ex) { }
|
|
catch (Exception ex) { }
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
- public static (List<StudentLessonData> studentLessonDatas, List<CodeBool> codeBools,List<string> pickup) GenStudentLessonData(LessonLocal lessonLocal, List<string> objectiveTypes)
|
|
|
|
|
|
+ public static (List<StudentLessonData> studentLessonDatas, List<CodeBool> codeBools, List<string> pickup) GenStudentLessonData(LessonLocal lessonLocal, List<string> objectiveTypes)
|
|
{
|
|
{
|
|
List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
@@ -663,7 +673,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
var pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
var pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
studentLessonDatas= pickupData.studentLessonDatas;
|
|
studentLessonDatas= pickupData.studentLessonDatas;
|
|
var codeBools = LessonETLService.GetCodeBools(studentLessonDatas);
|
|
var codeBools = LessonETLService.GetCodeBools(studentLessonDatas);
|
|
- return (studentLessonDatas,codeBools, pickupData.pickup);
|
|
|
|
|
|
+ return (studentLessonDatas, codeBools, pickupData.pickup);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -677,14 +687,14 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="force"></param>
|
|
/// <param name="force"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<TechCount> GetTeachCount(AzureCosmosFactory azureCosmos, string item, string pathLessons, List<string> ignore, List<string> objectiveTypes, AzureStorageFactory azureStorage, bool force)
|
|
|
|
|
|
+ public static async Task<TechCount> GetTeachCount(AzureCosmosFactory azureCosmos, string item, string pathLessons, List<string> ignore, List<string> objectiveTypes, AzureStorageFactory azureStorage, bool force, List<LessonLocal> lessonLocals)
|
|
{
|
|
{
|
|
- List<TechCount> techCounts = new List<TechCount>();
|
|
|
|
|
|
+ TechCount count = null;
|
|
if (item.EndsWith("-local.json"))
|
|
if (item.EndsWith("-local.json"))
|
|
{
|
|
{
|
|
string lessonId = item.Split("\\").Last().Replace("-local.json", "");
|
|
string lessonId = item.Split("\\").Last().Replace("-local.json", "");
|
|
string countFile = item.Replace("-local.json", "-count.json");
|
|
string countFile = item.Replace("-local.json", "-count.json");
|
|
- TechCount count = null;
|
|
|
|
|
|
+
|
|
if (!force)
|
|
if (!force)
|
|
{
|
|
{
|
|
if (System.IO.File.Exists(countFile))
|
|
if (System.IO.File.Exists(countFile))
|
|
@@ -700,202 +710,16 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
if (force)
|
|
if (force)
|
|
{
|
|
{
|
|
- string localjson = await System.IO.File.ReadAllTextAsync(item);
|
|
|
|
- var lessonLocal = localjson.ToObject<LessonLocal>();
|
|
|
|
- List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
|
|
- studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
|
|
- 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 pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
- studentLessonDatas= pickupData.studentLessonDatas;
|
|
|
|
- var codeBools = LessonETLService.GetCodeBools(studentLessonDatas);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (count!=null)
|
|
|
|
- {
|
|
|
|
- return count;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- 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)
|
|
|
|
- {
|
|
|
|
- if (item.EndsWith("-local.json"))
|
|
|
|
- {
|
|
|
|
- string lessonId = item.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
- string countFile = item.Replace("-local.json", "-count.json");
|
|
|
|
- TechCount count = null;
|
|
|
|
- if (!force)
|
|
|
|
- {
|
|
|
|
- if (System.IO.File.Exists(countFile))
|
|
|
|
- {
|
|
|
|
- string contjson = await System.IO.File.ReadAllTextAsync(countFile);
|
|
|
|
- count = contjson.ToObject<TechCount>();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- force=true;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (force)
|
|
|
|
|
|
+ var lessonLocal = lessonLocals.Find(x => x.lessonRecord.id.Equals(lessonId));
|
|
|
|
+ if (lessonLocal==null)
|
|
{
|
|
{
|
|
string localjson = await System.IO.File.ReadAllTextAsync(item);
|
|
string localjson = await System.IO.File.ReadAllTextAsync(item);
|
|
- var lessonLocal = localjson.ToObject<LessonLocal>();
|
|
|
|
- List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
|
|
- studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
|
|
- 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 pickupData = LessonETLService.GetPickupData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, studentLessonDatas, lessonLocal.lessonRecord.id);
|
|
|
|
- studentLessonDatas= pickupData.studentLessonDatas;
|
|
|
|
- var codeBools = LessonETLService.GetCodeBools(studentLessonDatas);
|
|
|
|
- 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", "");
|
|
|
|
- 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)
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- count.yearMonth=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)
|
|
|
|
- {
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- count.pickup= pickupData.pickup;
|
|
|
|
- // 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.AddRange(pickUp.ToList());
|
|
|
|
- //}
|
|
|
|
- string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
|
|
|
|
- await System.IO.File.WriteAllTextAsync($"{pathLessons}\\MM{count.yearMonth}\\{lessonLocal.lessonRecord.id}-count.json", count.ToJsonString());
|
|
|
|
- //if (force)
|
|
|
|
- //{
|
|
|
|
-
|
|
|
|
- //}
|
|
|
|
- //else
|
|
|
|
- //{
|
|
|
|
- // 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());
|
|
|
|
- // //只有不是强制更新的时候再去刷新线上的json文件。
|
|
|
|
-
|
|
|
|
- // 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());
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- 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)
|
|
|
|
- {
|
|
|
|
- yield return count;
|
|
|
|
|
|
+ lessonLocal = localjson.ToObject<LessonLocal>();
|
|
}
|
|
}
|
|
|
|
+ count= await GenTeachCount(lessonLocal, azureStorage, objectiveTypes, ignore, pathLessons, azureCosmos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
public static List<StudentLessonData> GetBaseInfo(LessonBase lessonBase, List<StudentLessonData> studentLessonDatas, string? id)
|
|
public static List<StudentLessonData> GetBaseInfo(LessonBase lessonBase, List<StudentLessonData> studentLessonDatas, string? id)
|
|
{
|
|
{
|
|
@@ -938,7 +762,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
$"/records/{lessonRecord.id}/IES/Cowork.json",
|
|
$"/records/{lessonRecord.id}/IES/Cowork.json",
|
|
$"/records/{lessonRecord.id}/Sokrates/SokratesRecords.json",
|
|
$"/records/{lessonRecord.id}/Sokrates/SokratesRecords.json",
|
|
};
|
|
};
|
|
- LessonLocal lessonLocal = new LessonLocal { lessonRecord=lessonRecord };
|
|
|
|
|
|
+ LessonLocal lessonLocal = new LessonLocal { lessonRecord=lessonRecord };
|
|
lessonLocal = await GetLessonFiles(lessonLocal, files, owner, _azureStorage);
|
|
lessonLocal = await GetLessonFiles(lessonLocal, files, owner, _azureStorage);
|
|
if (lessonLocal.lessonBase!=null && lessonLocal.lessonBase.student!=null)
|
|
if (lessonLocal.lessonBase!=null && lessonLocal.lessonBase.student!=null)
|
|
{
|
|
{
|
|
@@ -950,11 +774,11 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
return lessonLocal;
|
|
return lessonLocal;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private static async Task<LessonLocal> GetLessonFiles(LessonLocal lessonLocal, List<string> files, string owner, AzureStorageFactory _azureStorage)
|
|
private static async Task<LessonLocal> GetLessonFiles(LessonLocal lessonLocal, List<string> files, string owner, AzureStorageFactory _azureStorage)
|
|
{
|
|
{
|
|
#if DEBUG
|
|
#if DEBUG
|
|
- foreach (var file in files)
|
|
|
|
|
|
+ foreach (var file in files)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -1205,7 +1029,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return studentLessonDatas;
|
|
return studentLessonDatas;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1948,19 +1772,19 @@ namespace HTEX.Lib.ETL.Lesson
|
|
var order = studentLessonDatas.Where(x => x.attend==1).OrderByDescending(x => x.coworkRecord.itemRecords[p].itemScore);
|
|
var order = studentLessonDatas.Where(x => x.attend==1).OrderByDescending(x => x.coworkRecord.itemRecords[p].itemScore);
|
|
var maxItems = studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore);
|
|
var maxItems = studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore);
|
|
double max = 0;
|
|
double max = 0;
|
|
- if (studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore).IsNotEmpty())
|
|
|
|
|
|
+ if (studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore).IsNotEmpty())
|
|
{
|
|
{
|
|
max=studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
|
|
max=studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
|
|
}
|
|
}
|
|
double min = 0;
|
|
double min = 0;
|
|
- if (studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.Last().coworkRecord.itemRecords[p].itemScore).IsNotEmpty())
|
|
|
|
|
|
+ if (studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.Last().coworkRecord.itemRecords[p].itemScore).IsNotEmpty())
|
|
{
|
|
{
|
|
min= studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.Last().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
|
|
min= studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.Last().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
|
|
}
|
|
}
|
|
double sum = 0;
|
|
double sum = 0;
|
|
if (studentLessonDatas.FindAll(x => x.attend==1).IsNotEmpty())
|
|
if (studentLessonDatas.FindAll(x => x.attend==1).IsNotEmpty())
|
|
{
|
|
{
|
|
- sum= studentLessonDatas.FindAll(x => x.attend==1).Sum(x => x.coworkRecord.itemRecords[p].itemScore);
|
|
|
|
|
|
+ sum= studentLessonDatas.FindAll(x => x.attend==1).Sum(x => x.coworkRecord.itemRecords[p].itemScore);
|
|
}
|
|
}
|
|
foreach (var student in studentLessonDatas)
|
|
foreach (var student in studentLessonDatas)
|
|
{
|
|
{
|
|
@@ -2130,19 +1954,19 @@ namespace HTEX.Lib.ETL.Lesson
|
|
double max = 0;
|
|
double max = 0;
|
|
if (maxItems.IsNotEmpty())
|
|
if (maxItems.IsNotEmpty())
|
|
{
|
|
{
|
|
- max = meteor_VoteSummary.FindAll(x => x.result==order.First().result).First().result;
|
|
|
|
|
|
+ max = meteor_VoteSummary.FindAll(x => x.result==order.First().result).First().result;
|
|
}
|
|
}
|
|
double min = 0;
|
|
double min = 0;
|
|
- if (meteor_VoteSummary.FindAll(x => x.result==order.Last().result).IsNotEmpty())
|
|
|
|
|
|
+ if (meteor_VoteSummary.FindAll(x => x.result==order.Last().result).IsNotEmpty())
|
|
{
|
|
{
|
|
- min = meteor_VoteSummary.FindAll(x => x.result==order.Last().result).First().result;
|
|
|
|
|
|
+ min = meteor_VoteSummary.FindAll(x => x.result==order.Last().result).First().result;
|
|
}
|
|
}
|
|
double sum = 0;
|
|
double sum = 0;
|
|
if (meteor_VoteSummary.IsNotEmpty())
|
|
if (meteor_VoteSummary.IsNotEmpty())
|
|
{
|
|
{
|
|
sum = meteor_VoteSummary.Sum(x => x.result);
|
|
sum = meteor_VoteSummary.Sum(x => x.result);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//排名指数计算=( 当前值分数- 298) / (9992 - 298) * (99 - 60) + 60
|
|
//排名指数计算=( 当前值分数- 298) / (9992 - 298) * (99 - 60) + 60
|
|
//将每个人的积分转化为60-100
|
|
//将每个人的积分转化为60-100
|
|
//排名 = (积分 - 最低积分) / (最高积分 - 最低积分) * (最大排名 - 最小排名) + 最小排名
|
|
//排名 = (积分 - 最低积分) / (最高积分 - 最低积分) * (最大排名 - 最小排名) + 最小排名
|
|
@@ -2224,7 +2048,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
{
|
|
{
|
|
min = smartRatingData.smartRateSummary.meteor_ScoreSummary.FindAll(x => x.result==order.Last().result).First().result;
|
|
min = smartRatingData.smartRateSummary.meteor_ScoreSummary.FindAll(x => x.result==order.Last().result).First().result;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
var sum = smartRatingData.smartRateSummary.meteor_ScoreSummary.Sum(x => x.result);
|
|
var sum = smartRatingData.smartRateSummary.meteor_ScoreSummary.Sum(x => x.result);
|
|
|
|
|
|
foreach (var meteor_ScoreSummary in smartRatingData.smartRateSummary.meteor_ScoreSummary)
|
|
foreach (var meteor_ScoreSummary in smartRatingData.smartRateSummary.meteor_ScoreSummary)
|
|
@@ -2293,15 +2117,15 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
var order = smartRatingData.smartRateSummary.mutualSummary.mutualResults.Where(x => x.result>0).OrderByDescending(x => x.result);
|
|
var order = smartRatingData.smartRateSummary.mutualSummary.mutualResults.Where(x => x.result>0).OrderByDescending(x => x.result);
|
|
var maxItems = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.First().result);
|
|
var maxItems = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.First().result);
|
|
- double max = 0;
|
|
|
|
- if (maxItems.IsNotEmpty())
|
|
|
|
|
|
+ double max = 0;
|
|
|
|
+ if (maxItems.IsNotEmpty())
|
|
{
|
|
{
|
|
- max = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.First().result).First().result;
|
|
|
|
|
|
+ max = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.First().result).First().result;
|
|
}
|
|
}
|
|
double min = 0;
|
|
double min = 0;
|
|
if (smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.Last().result).IsNotEmpty())
|
|
if (smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.Last().result).IsNotEmpty())
|
|
- {
|
|
|
|
- min = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.Last().result).First().result;
|
|
|
|
|
|
+ {
|
|
|
|
+ min = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.Last().result).First().result;
|
|
}
|
|
}
|
|
var sum = smartRatingData.smartRateSummary.mutualSummary.mutualResults.Sum(x => x.result);
|
|
var sum = smartRatingData.smartRateSummary.mutualSummary.mutualResults.Sum(x => x.result);
|
|
foreach (var mutualResult in smartRatingData.smartRateSummary.mutualSummary.mutualResults)
|
|
foreach (var mutualResult in smartRatingData.smartRateSummary.mutualSummary.mutualResults)
|
|
@@ -2361,7 +2185,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="studentLessonDatas"></param>
|
|
/// <param name="studentLessonDatas"></param>
|
|
/// <param name="lessonDataAnalysis"></param>
|
|
/// <param name="lessonDataAnalysis"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static List<StudentLessonItem> ProcessStudentDataV2(List<StudentLessonData> studentLessonDatas, LessonDataAnalysisModel lessonDataAnalysis, List<CodeBool> codeBools)
|
|
|
|
|
|
+ public static List<StudentLessonItem> ProcessStudentDataV2(List<StudentLessonData> studentLessonDatas, LessonDataAnalysisModel lessonDataAnalysis, List<CodeBool> codeBools)
|
|
{
|
|
{
|
|
|
|
|
|
//历史记录的个人计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
//历史记录的个人计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
@@ -2369,7 +2193,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
//历史记录的互动计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
//历史记录的互动计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
//var max_t = lessonDataAnalysis.tscore.Max();
|
|
//var max_t = lessonDataAnalysis.tscore.Max();
|
|
//历史记录的小组计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
//历史记录的小组计分集合,通过“2倍标准差规则”移除异常值后得到的集合
|
|
- // var max_h = lessonDataAnalysis.gscore.Max();
|
|
|
|
|
|
+ // var max_h = lessonDataAnalysis.gscore.Max();
|
|
var j = InteractWeight.T1;
|
|
var j = InteractWeight.T1;
|
|
double t = InteractWeight.TT;
|
|
double t = InteractWeight.TT;
|
|
List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
|
|
List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
|
|
@@ -2382,11 +2206,11 @@ namespace HTEX.Lib.ETL.Lesson
|
|
u=100.0;
|
|
u=100.0;
|
|
}
|
|
}
|
|
//c个人计分指数,d互动计分指数,e小组计分指数
|
|
//c个人计分指数,d互动计分指数,e小组计分指数
|
|
- double d = 0, e = 0;
|
|
|
|
|
|
+ double d = 0, e = 0;
|
|
//本节课教师手动给学生的个人计分
|
|
//本节课教师手动给学生的个人计分
|
|
var s = studentLessonData.pscore;
|
|
var s = studentLessonData.pscore;
|
|
//个人计分指数
|
|
//个人计分指数
|
|
- double c = GetPersent(lessonDataAnalysis.pscore, s).persent;// s*1.0/max_q;
|
|
|
|
|
|
+ double c = GetPersent(lessonDataAnalysis.pscore, s).persent;// s*1.0/max_q;
|
|
|
|
|
|
{
|
|
{
|
|
//智慧挑人
|
|
//智慧挑人
|
|
@@ -2431,7 +2255,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
var l = n<lessonDataAnalysis.interactPass ? lessonDataAnalysis.interactLow : n>lessonDataAnalysis.interactGood ? lessonDataAnalysis.interactHigh : lessonDataAnalysis.interactMedium;
|
|
var l = n<lessonDataAnalysis.interactPass ? lessonDataAnalysis.interactLow : n>lessonDataAnalysis.interactGood ? lessonDataAnalysis.interactHigh : lessonDataAnalysis.interactMedium;
|
|
//出题系数=当前互动次数与互动通过次数之间的比例*当前互动次数与互动中位数之间的比例*当前互动次数与互动高阶互动频次的比例
|
|
//出题系数=当前互动次数与互动通过次数之间的比例*当前互动次数与互动中位数之间的比例*当前互动次数与互动高阶互动频次的比例
|
|
// var m = (n*1.0/l) *(p.persent/100) * (curr.Value.Count*1.0/all.Count());
|
|
// var m = (n*1.0/l) *(p.persent/100) * (curr.Value.Count*1.0/all.Count());
|
|
- var m = (n*1.0/l) *(p.persent/100) * (lessonDataAnalysis.interactNormal.Where(x => x.Value>= curr.Value[0]&& x.Value<=curr.Value[1] ).Sum(x=>x.Value)*1.0/lessonDataAnalysis.interactNormal.Sum(x=>x.Value));
|
|
|
|
|
|
+ var m = (n*1.0/l) *(p.persent/100) * (lessonDataAnalysis.interactNormal.Where(x => x.Value>= curr.Value[0]&& x.Value<=curr.Value[1]).Sum(x => x.Value)*1.0/lessonDataAnalysis.interactNormal.Sum(x => x.Value));
|
|
//学生作答次数
|
|
//学生作答次数
|
|
var w = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Count()*1.0;
|
|
var w = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Count()*1.0;
|
|
//作答正确数(包括部分正确)
|
|
//作答正确数(包括部分正确)
|
|
@@ -2524,8 +2348,8 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//互动专注指数
|
|
//互动专注指数
|
|
// var b = ((w*w/n)+(r*r/w))*1.0*m;
|
|
// var b = ((w*w/n)+(r*r/w))*1.0*m;
|
|
// var f2 = Math.Round(200*1.0/(1+Math.Exp(-(b)))-100, 4);
|
|
// var f2 = Math.Round(200*1.0/(1+Math.Exp(-(b)))-100, 4);
|
|
@@ -2555,20 +2379,20 @@ namespace HTEX.Lib.ETL.Lesson
|
|
f2=(w/n)*100+ 0.2 * (w/n)* (r/w)*100;
|
|
f2=(w/n)*100+ 0.2 * (w/n)* (r/w)*100;
|
|
if (f2>100) { f2=100; }
|
|
if (f2>100) { f2=100; }
|
|
//智慧挑人有被挑中的
|
|
//智慧挑人有被挑中的
|
|
- if (f2>0)
|
|
|
|
|
|
+ if (f2>0)
|
|
{
|
|
{
|
|
if (lessonItem.zh_tr>0)
|
|
if (lessonItem.zh_tr>0)
|
|
{
|
|
{
|
|
f2=f2*0.8+lessonItem.zh_tr*0.2;
|
|
f2=f2*0.8+lessonItem.zh_tr*0.2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else{
|
|
|
|
|
|
+ else {
|
|
if (lessonItem.zh_tr>0)
|
|
if (lessonItem.zh_tr>0)
|
|
{
|
|
{
|
|
f2=lessonItem.zh_tr*0.5;
|
|
f2=lessonItem.zh_tr*0.5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
lessonItem.hd_cy=f2;
|
|
lessonItem.hd_cy=f2;
|
|
lessonItem.hd_cyc=w;
|
|
lessonItem.hd_cyc=w;
|
|
@@ -2599,7 +2423,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
// _logger.LogInformation($"{studentLessonData.id}=>评测指数:{f8}\t得分率:{Math.Round(sum_s/n,4)}\t专注指数:{f9}\t作答率:{Math.Round(sum_a/n,4)}");
|
|
// _logger.LogInformation($"{studentLessonData.id}=>评测指数:{f8}\t得分率:{Math.Round(sum_s/n,4)}\t专注指数:{f9}\t作答率:{Math.Round(sum_a/n,4)}");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
{
|
|
{
|
|
//小组相关指数
|
|
//小组相关指数
|
|
/* PickupNameLst
|
|
/* PickupNameLst
|
|
@@ -2620,10 +2444,10 @@ namespace HTEX.Lib.ETL.Lesson
|
|
* Pickup0_49
|
|
* Pickup0_49
|
|
*/
|
|
*/
|
|
var grpPicks = studentLessonData.pickups.Where(x => x.StartsWith("1--") && x.Contains("Grp", StringComparison.OrdinalIgnoreCase));
|
|
var grpPicks = studentLessonData.pickups.Where(x => x.StartsWith("1--") && x.Contains("Grp", StringComparison.OrdinalIgnoreCase));
|
|
- var groups= studentLessonDatas.Where(x => !string.IsNullOrWhiteSpace(x.groupId)).Select(x => x.groupId).Distinct();
|
|
|
|
|
|
+ var groups = studentLessonDatas.Where(x => !string.IsNullOrWhiteSpace(x.groupId)).Select(x => x.groupId).Distinct();
|
|
int groupCount = 1;
|
|
int groupCount = 1;
|
|
int memberCount = studentLessonDatas.Count;
|
|
int memberCount = studentLessonDatas.Count;
|
|
- if (groups!=null &&groups.Count()>0)
|
|
|
|
|
|
+ if (groups!=null &&groups.Count()>0)
|
|
{
|
|
{
|
|
groupCount=groups.Count();
|
|
groupCount=groups.Count();
|
|
var members = studentLessonDatas.Where(x => !string.IsNullOrWhiteSpace(x.groupId) && !string.IsNullOrWhiteSpace(studentLessonData.groupId)&&x.groupId.Equals(studentLessonData.groupId));
|
|
var members = studentLessonDatas.Where(x => !string.IsNullOrWhiteSpace(x.groupId) && !string.IsNullOrWhiteSpace(studentLessonData.groupId)&&x.groupId.Equals(studentLessonData.groupId));
|
|
@@ -2638,11 +2462,11 @@ namespace HTEX.Lib.ETL.Lesson
|
|
double groupType = 0;
|
|
double groupType = 0;
|
|
foreach (var grppick in grpPicks)
|
|
foreach (var grppick in grpPicks)
|
|
{
|
|
{
|
|
- pickRate+= (1.0/groupCount) * (1.0/memberCount)* 100 ;
|
|
|
|
|
|
+ pickRate+= (1.0/groupCount) * (1.0/memberCount)* 100;
|
|
}
|
|
}
|
|
if (grpPickCount>0)
|
|
if (grpPickCount>0)
|
|
{
|
|
{
|
|
- pickRate=100- Math.Round(pickRate/grpPickCount,4);
|
|
|
|
|
|
+ pickRate=100- Math.Round(pickRate/grpPickCount, 4);
|
|
groupType+=1;
|
|
groupType+=1;
|
|
lessonItem.xz_tr=grpPickCount;
|
|
lessonItem.xz_tr=grpPickCount;
|
|
}
|
|
}
|
|
@@ -2663,22 +2487,22 @@ namespace HTEX.Lib.ETL.Lesson
|
|
groupType+=1;
|
|
groupType+=1;
|
|
lessonItem.xz_jf=studentLessonData.gscore;
|
|
lessonItem.xz_jf=studentLessonData.gscore;
|
|
}
|
|
}
|
|
- double groupTask = 0;
|
|
|
|
- var groupTasks= studentLessonData.taskRecord.itemRecords.Where(x => x.isGroup);
|
|
|
|
- if(groupTasks!=null && groupTasks.Count()>0)
|
|
|
|
- {
|
|
|
|
|
|
+ double groupTask = 0;
|
|
|
|
+ var groupTasks = studentLessonData.taskRecord.itemRecords.Where(x => x.isGroup);
|
|
|
|
+ if (groupTasks!=null && groupTasks.Count()>0)
|
|
|
|
+ {
|
|
//double score = CalculateScore(groupTasks.Sum(x=>x.optCount));
|
|
//double score = CalculateScore(groupTasks.Sum(x=>x.optCount));
|
|
groupType+=1;
|
|
groupType+=1;
|
|
- double a= lessonItem.xz_sc=groupTasks.Sum(x => x.optCount);
|
|
|
|
|
|
+ double a = lessonItem.xz_sc=groupTasks.Sum(x => x.optCount);
|
|
double n = groupTasks.Count();
|
|
double n = groupTasks.Count();
|
|
double w = groupTasks.Where(x => x.optCount>0).Count();
|
|
double w = groupTasks.Where(x => x.optCount>0).Count();
|
|
groupTask= Math.Round(80*1.0/(1+Math.Exp(-(w/n+(w/n)*(a/w)-1)))+20, 4);
|
|
groupTask= Math.Round(80*1.0/(1+Math.Exp(-(w/n+(w/n)*(a/w)-1)))+20, 4);
|
|
|
|
|
|
}
|
|
}
|
|
double fxGrp = 0;
|
|
double fxGrp = 0;
|
|
- if (groupType>0) {
|
|
|
|
|
|
+ if (groupType>0) {
|
|
fxGrp = (pickRate+coworkRate+gscoreRate+groupTask)/groupType; }
|
|
fxGrp = (pickRate+coworkRate+gscoreRate+groupTask)/groupType; }
|
|
- if (groupType==2 &&(pickRate>0 && gscoreRate>0) )
|
|
|
|
|
|
+ if (groupType==2 &&(pickRate>0 && gscoreRate>0))
|
|
{
|
|
{
|
|
fxGrp = (pickRate*0.8+coworkRate+gscoreRate*0.8+groupTask)/groupType;
|
|
fxGrp = (pickRate*0.8+coworkRate+gscoreRate*0.8+groupTask)/groupType;
|
|
}
|
|
}
|
|
@@ -2686,28 +2510,27 @@ namespace HTEX.Lib.ETL.Lesson
|
|
{
|
|
{
|
|
fxGrp=(pickRate+coworkRate+gscoreRate+groupTask)*0.8/groupType;
|
|
fxGrp=(pickRate+coworkRate+gscoreRate+groupTask)*0.8/groupType;
|
|
}
|
|
}
|
|
- lessonItem.hz_nl=Math.Round(fxGrp,4);
|
|
|
|
|
|
+ lessonItem.hz_nl=Math.Round(fxGrp, 4);
|
|
}
|
|
}
|
|
{
|
|
{
|
|
//任务相关指数
|
|
//任务相关指数
|
|
double n = studentLessonData.taskRecord.itemRecords.Count()*1.0;
|
|
double n = studentLessonData.taskRecord.itemRecords.Count()*1.0;
|
|
if (n>0)
|
|
if (n>0)
|
|
{
|
|
{
|
|
- // double max_m = lessonDataAnalysis.task.Select(x=>x.Key).Max();
|
|
|
|
|
|
+ // double max_m = lessonDataAnalysis.task.Select(x=>x.Key).Max();
|
|
double w = studentLessonData.taskRecord.itemRecords.Where(x => x.resultWeight>0).Count()*1.0;
|
|
double w = studentLessonData.taskRecord.itemRecords.Where(x => x.resultWeight>0).Count()*1.0;
|
|
-
|
|
|
|
|
|
+
|
|
lessonItem.rw_fqc =n;
|
|
lessonItem.rw_fqc =n;
|
|
lessonItem.rw_cyc =w;
|
|
lessonItem.rw_cyc =w;
|
|
- double a = lessonItem.rw_zpc =studentLessonData.taskRecord.itemRecords.Sum(x=>x.optCount);
|
|
|
|
|
|
+ double a = lessonItem.rw_zpc =studentLessonData.taskRecord.itemRecords.Sum(x => x.optCount);
|
|
//lessonItem.rw_cx =f4;
|
|
//lessonItem.rw_cx =f4;
|
|
- // lessonItem.rw_cy =f5;
|
|
|
|
|
|
+ // lessonItem.rw_cy =f5;
|
|
double score = 0;
|
|
double score = 0;
|
|
if (w>0 && lessonItem.rw_zpc>0)
|
|
if (w>0 && lessonItem.rw_zpc>0)
|
|
{
|
|
{
|
|
- score= Math.Round(80*1.0/(1+Math.Exp(-(w/n+(w/n)*(a/w)-1)))+20,4);
|
|
|
|
|
|
+ score= Math.Round(80*1.0/(1+Math.Exp(-(w/n+(w/n)*(a/w)-1)))+20, 4);
|
|
}
|
|
}
|
|
lessonItem.rw_cx =score;
|
|
lessonItem.rw_cx =score;
|
|
- lessonItem.rw_cy =score;
|
|
|
|
}
|
|
}
|
|
// _logger.LogInformation($"{studentLessonData.id}=>任务指数:{f4}\t专注指数:{f5}\t任务次数:{n}\t参与次数:{w}\t");
|
|
// _logger.LogInformation($"{studentLessonData.id}=>任务指数:{f4}\t专注指数:{f5}\t任务次数:{n}\t参与次数:{w}\t");
|
|
|
|
|
|
@@ -2772,12 +2595,12 @@ namespace HTEX.Lib.ETL.Lesson
|
|
//{
|
|
//{
|
|
// //x=sw/(j *wc);
|
|
// //x=sw/(j *wc);
|
|
//}
|
|
//}
|
|
- // double max_xzcg = 75;
|
|
|
|
|
|
+ // double max_xzcg = 75;
|
|
//double k = (wc*wc/n+x)/n+ wc*(ss/max_xzcg)* (wc/n);
|
|
//double k = (wc*wc/n+x)/n+ wc*(ss/max_xzcg)* (wc/n);
|
|
//double k = wc/n +wc*(ss/max_xzcg)* (wc/n);
|
|
//double k = wc/n +wc*(ss/max_xzcg)* (wc/n);
|
|
var avg = lessonDataAnalysis.stuCowork.Select(x => x.Value* x.Key).Sum()*1.0/lessonDataAnalysis.stuCowork.Sum(x => x.Value);
|
|
var avg = lessonDataAnalysis.stuCowork.Select(x => x.Value* x.Key).Sum()*1.0/lessonDataAnalysis.stuCowork.Sum(x => x.Value);
|
|
- double k=(GetPersent(lessonDataAnalysis.stuCowork, ss).persent/100+ ss/ avg)* (wc/n );
|
|
|
|
- // double f6 = Math.Round(190*1.0/(1+Math.Exp(-(k)))-95, 4);
|
|
|
|
|
|
+ double k = (GetPersent(lessonDataAnalysis.stuCowork, ss).persent/100+ ss/ avg)* (wc/n);
|
|
|
|
+ // double f6 = Math.Round(190*1.0/(1+Math.Exp(-(k)))-95, 4);
|
|
double f7 = Math.Round(200*1.0/(1+Math.Exp(-(k)))-100, 4);
|
|
double f7 = Math.Round(200*1.0/(1+Math.Exp(-(k)))-100, 4);
|
|
|
|
|
|
lessonItem.xz_fqc =n;
|
|
lessonItem.xz_fqc =n;
|
|
@@ -2791,7 +2614,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
|
|
|
double xx_cx = 0, xx_cy = 0;
|
|
double xx_cx = 0, xx_cy = 0;
|
|
int avg_cx = 0, avg_cy = 0;
|
|
int avg_cx = 0, avg_cy = 0;
|
|
- if (lessonItem.xz_cx>0 && codeBools.FindAll(x=>x.code.Equals("xz") && x.value==true).IsNotEmpty())
|
|
|
|
|
|
+ if (lessonItem.xz_cx>0 && codeBools.FindAll(x => x.code.Equals("xz") && x.value==true).IsNotEmpty())
|
|
{
|
|
{
|
|
avg_cx+=1;
|
|
avg_cx+=1;
|
|
}
|
|
}
|
|
@@ -2812,7 +2635,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
{
|
|
{
|
|
avg_cx+=1;
|
|
avg_cx+=1;
|
|
}
|
|
}
|
|
- if (lessonItem.hz_nl>0 )
|
|
|
|
|
|
+ if (lessonItem.hz_nl>0)
|
|
{
|
|
{
|
|
avg_cx+=1;
|
|
avg_cx+=1;
|
|
}
|
|
}
|
|
@@ -2832,7 +2655,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
{
|
|
{
|
|
avg_cy+=1;
|
|
avg_cy+=1;
|
|
}
|
|
}
|
|
- if (lessonItem.rw_cy>0 && codeBools.FindAll(x => x.code.Equals("rw") && x.value==true).IsNotEmpty())
|
|
|
|
|
|
+ if (lessonItem.rw_cx>0 && codeBools.FindAll(x => x.code.Equals("rw") && x.value==true).IsNotEmpty())
|
|
{
|
|
{
|
|
avg_cy+=1;
|
|
avg_cy+=1;
|
|
}
|
|
}
|
|
@@ -2852,9 +2675,9 @@ namespace HTEX.Lib.ETL.Lesson
|
|
//{
|
|
//{
|
|
// avg_cy+=1;
|
|
// avg_cy+=1;
|
|
//}
|
|
//}
|
|
- if (avg_cy>0)
|
|
|
|
|
|
+ if (avg_cy>0)
|
|
{
|
|
{
|
|
- xx_cy+=Math.Round(lessonItem.hd_cy * 1.0/avg_cy+ lessonItem.pc_zd* 1.0/avg_cy+ lessonItem.rw_cy* 1.0/avg_cy+ lessonItem.pj_nl* 1.0/avg_cy+ lessonItem.xz_cy* 1.0/avg_cy+ lessonItem.hz_nl* 1.0/avg_cy, 4);
|
|
|
|
|
|
+ xx_cy+=Math.Round(lessonItem.hd_cy * 1.0/avg_cy+ lessonItem.pc_zd* 1.0/avg_cy+ lessonItem.rw_cx* 1.0/avg_cy+ lessonItem.pj_nl* 1.0/avg_cy+ lessonItem.xz_cy* 1.0/avg_cy+ lessonItem.hz_nl* 1.0/avg_cy, 4);
|
|
}
|
|
}
|
|
lessonItem.xx_cx=xx_cx;
|
|
lessonItem.xx_cx=xx_cx;
|
|
lessonItem.xx_cy=xx_cy;
|
|
lessonItem.xx_cy=xx_cy;
|
|
@@ -2909,10 +2732,10 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="items"></param>
|
|
/// <param name="items"></param>
|
|
/// <param name="filePath"></param>
|
|
/// <param name="filePath"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task ExportToExcelAzureBlob(List<StudentLessonItem> items, AzureStorageFactory azureStorage,string owner , string path , XmlDocument xmlDocument,List<string> summarys, PropertyInfo[] properties)
|
|
|
|
|
|
+ public static async Task ExportToExcelAzureBlob(List<StudentLessonItem> items, AzureStorageFactory azureStorage, string owner, string path, XmlDocument xmlDocument, List<string> summarys, PropertyInfo[] properties)
|
|
{
|
|
{
|
|
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
|
|
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
|
|
- using (var memoryStream = new MemoryStream())
|
|
|
|
|
|
+ using (var memoryStream = new MemoryStream())
|
|
{
|
|
{
|
|
using (ExcelPackage package = new ExcelPackage())
|
|
using (ExcelPackage package = new ExcelPackage())
|
|
{
|
|
{
|
|
@@ -3025,21 +2848,21 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="nums"></param>
|
|
/// <param name="nums"></param>
|
|
/// <param name="curr"></param>
|
|
/// <param name="curr"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static (double persent, int count) GetPersent(List<KeyValuePair<double, int>> nums, double curr)
|
|
|
|
|
|
+ public static (double persent, int count) GetPersent(List<KeyValuePair<double, int>> nums, double curr)
|
|
{
|
|
{
|
|
int count = 0;
|
|
int count = 0;
|
|
- foreach (var op in nums.Select(x=>x.Key).OrderBy(x => x))
|
|
|
|
|
|
+ foreach (var op in nums.Select(x => x.Key).OrderBy(x => x))
|
|
{
|
|
{
|
|
if (op <= curr)
|
|
if (op <= curr)
|
|
{
|
|
{
|
|
- count+=nums.Find(x=>x.Key==op).Value;
|
|
|
|
|
|
+ count+=nums.Find(x => x.Key==op).Value;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return (count *1.0/ nums.Select(x=>x.Value).Sum() * 100, count);
|
|
|
|
|
|
+ return (count *1.0/ nums.Select(x => x.Value).Sum() * 100, count);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -3065,6 +2888,14 @@ namespace HTEX.Lib.ETL.Lesson
|
|
return (count *1.0/ nums.Count() * 100, count);
|
|
return (count *1.0/ nums.Count() * 100, count);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ public class LessonStudentResult
|
|
|
|
+ {
|
|
|
|
+ public string id { get; set; }
|
|
|
|
+ public string owner { get; set; }
|
|
|
|
+ public List<StudentLessonItem> studentLessons { get; set; } = new List<StudentLessonItem>();
|
|
|
|
+ public List<CodeBool> codeBools { get; set; } = new List<CodeBool>();
|
|
|
|
+ public List<StudentLessonData> lessonDatas { get; set; } = new List<StudentLessonData>();
|
|
|
|
+ }
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 学生导出Excel的Entity
|
|
/// 学生导出Excel的Entity
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -3105,7 +2936,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// </summary>
|
|
/// </summary>
|
|
public double hd_cx { get; set; } = 0;
|
|
public double hd_cx { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 互动专注指数
|
|
|
|
|
|
+ /// 互动参与指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double hd_cy { get; set; } = 0;
|
|
public double hd_cy { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -3129,13 +2960,10 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// </summary>
|
|
/// </summary>
|
|
public double rw_zpc { get; set; } = 0;
|
|
public double rw_zpc { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 任务成效指数
|
|
|
|
|
|
+ /// 任务指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double rw_cx { get; set; } = 0;
|
|
public double rw_cx { get; set; } = 0;
|
|
- /// <summary>
|
|
|
|
- /// 任务专注指数
|
|
|
|
- /// </summary>
|
|
|
|
- public double rw_cy { get; set; } = 0;
|
|
|
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 评价发起次数
|
|
/// 评价发起次数
|
|
@@ -3178,7 +3006,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// </summary>
|
|
/// </summary>
|
|
public double pj_po { get; set; } = 0;
|
|
public double pj_po { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 评价能力
|
|
|
|
|
|
+ /// 评价能力指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double pj_nl { get; set; } = 0;
|
|
public double pj_nl { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -3198,7 +3026,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// </summary>
|
|
/// </summary>
|
|
public double xz_cx { get; set; } = 0;
|
|
public double xz_cx { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 协作专注指数
|
|
|
|
|
|
+ /// 协作参与指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double xz_cy { get; set; } = 0;
|
|
public double xz_cy { get; set; } = 0;
|
|
|
|
|
|
@@ -3219,16 +3047,16 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// </summary>
|
|
/// </summary>
|
|
public double xz_sc { get; set; } = 0;
|
|
public double xz_sc { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 合作能力
|
|
|
|
|
|
+ /// 合作能力指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double hz_nl { get; set; } = 0;
|
|
public double hz_nl { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 学习成效
|
|
|
|
|
|
+ /// 学习成效指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double xx_cx { get; set; } = 0;
|
|
public double xx_cx { get; set; } = 0;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 学习专注度
|
|
|
|
|
|
+ /// 学习态度指数
|
|
/// </summary>
|
|
/// </summary>
|
|
public double xx_cy { get; set; } = 0;
|
|
public double xx_cy { get; set; } = 0;
|
|
}
|
|
}
|