|
@@ -78,8 +78,458 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
lessonMinutes = 45,
|
|
|
};
|
|
|
}
|
|
|
- return Ok();
|
|
|
+
|
|
|
+ List<School> schools = new List<School>();
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School")
|
|
|
+ .GetItemQueryIterator<School>(queryText: $"select value(c) from c where c.areaId='{area.id}' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
+ {
|
|
|
+ schools.Add(item);
|
|
|
+ }
|
|
|
+ HashSet<string> dimensions = new HashSet<string>();
|
|
|
+ List<Ability> abilities = new List<Ability>();
|
|
|
+ List<DimensionCount> areaDimensionCount = new List<DimensionCount>();
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal")
|
|
|
+ .GetItemQueryIterator<Ability>(queryText: $"select c.id, c.name,c.no,c.dimension, c.env from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{standard}") }))
|
|
|
+ {
|
|
|
+
|
|
|
+ dimensions.Add(item.dimension);
|
|
|
+ abilities.Add(item);
|
|
|
+ }
|
|
|
+ dimensions.ToList().ForEach(x =>
|
|
|
+ {
|
|
|
+ areaDimensionCount.Add(new DimensionCount { dimension = x, count = 0 });
|
|
|
+ });
|
|
|
+ List<string> abilitieIds = abilities.Select(x => x.id).ToList();
|
|
|
+ List<AbilityCount> areaAbilityCounts = abilities.Select(x => new AbilityCount { abilityEnv=x.env, abilityId=x.id, abilityName=x.name, abilityNo=x.no, count=0,dimension=x.dimension}).ToList();
|
|
|
+ int schoolCount = 0;
|
|
|
+ int teacherCount = 0;
|
|
|
+ int joinCount = 0;
|
|
|
+ //在线时长
|
|
|
+ int videoTime = 0;
|
|
|
+ List<SchoolCount> schoolDatas = new List<SchoolCount>();
|
|
|
+ ///线上完成人数
|
|
|
+ int onlineTeacherCount = 0;
|
|
|
+ ///线下完成人数
|
|
|
+ int offlineTeacherCount = 0;
|
|
|
+ ///应用考核完成人数
|
|
|
+ int schoolScoreTeacherCount = 0;
|
|
|
+ //课堂实录完成人数
|
|
|
+ int classVideoTeacherCount = 0;
|
|
|
+ //
|
|
|
+ await foreach ((List<TeacherStatistic> groupMembers, List<DimensionCount> dimensionCount,
|
|
|
+ List<AbilityCount> abilityCount, int teacherCount, int joinCount, int subCount, int ok50TimeCount,
|
|
|
+ int hasScoreCount, int hasSubmitCount, int unDoneCount, int unSubmitCount, int okCount,int schoolVideoTime, SchoolCount schoolCount,
|
|
|
+ int onlineTeacherCount, int offlineTeacherCount, int schoolScoreTeacherCount, int classVideoTeacherCount) item in StatisticsSchool(schools,client,setting,abilities,dimensions,abilitieIds)) {
|
|
|
+ areaDimensionCount.ForEach(x => {
|
|
|
+ x.count=x.count+item.dimensionCount.Find(y => y.dimension.Equals(x.dimension)).count;
|
|
|
+ });
|
|
|
+ areaAbilityCounts.ForEach(x => {
|
|
|
+ x.count = x.count + item.abilityCount.Find(y => y.abilityId.Equals(x.abilityId)).count;
|
|
|
+ });
|
|
|
+ teacherCount = teacherCount + item.teacherCount;
|
|
|
+ joinCount = joinCount + item.joinCount;
|
|
|
+ videoTime = videoTime + item.schoolVideoTime;
|
|
|
+ schoolCount++;
|
|
|
+ schoolDatas.Add(item.schoolCount);
|
|
|
+ onlineTeacherCount = onlineTeacherCount + item.onlineTeacherCount;
|
|
|
+ offlineTeacherCount = offlineTeacherCount + item.offlineTeacherCount;
|
|
|
+ schoolScoreTeacherCount = schoolScoreTeacherCount + item.schoolScoreTeacherCount;
|
|
|
+ classVideoTeacherCount = classVideoTeacherCount + item.classVideoTeacherCount;
|
|
|
+ }
|
|
|
+ return Ok(new { setting,areaDimensionCount,areaAbilityCounts, teacherCount,joinCount, schoolCount,videoTime, schoolDatas, onlineTeacherCount, offlineTeacherCount, schoolScoreTeacherCount, classVideoTeacherCount });
|
|
|
+ }
|
|
|
+
|
|
|
+ private async IAsyncEnumerable<(List<TeacherStatistic> groupMembers, List<DimensionCount> dimensionCount,
|
|
|
+ List<AbilityCount> abilityCount, int teacherCount, int joinCount, int subCount, int ok50TimeCount,
|
|
|
+ int hasScoreCount, int hasSubmitCount, int unDoneCount ,int unSubmitCount, int okCount,int schoolVideoTime, SchoolCount schoolCount,
|
|
|
+ int onlineTeacherCount, int offlineTeacherCount, int schoolScoreTeacherCount, int classVideoTeacherCount)>
|
|
|
+ StatisticsSchool(List<School> schools, CosmosClient client, AreaSetting setting, List<Ability> abilities, HashSet<string> dimensions, List<string> abilitieIds) {
|
|
|
+ foreach (var school in schools) {
|
|
|
+ HashSet<string> groups = new HashSet<string>();
|
|
|
+ HashSet<string> groupNames = new HashSet<string>();
|
|
|
+
|
|
|
+ List<ClassVideo> classVideos = new List<ClassVideo>();
|
|
|
+ List<AbilitySub> abilitySubs = new List<AbilitySub>();
|
|
|
+ string code = $"ClassVideo-{school.id}";
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<ClassVideo>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))
|
|
|
+ {
|
|
|
+ classVideos.Add(item);
|
|
|
+ }
|
|
|
+ List<TchList> tchLists = new List<TchList>();
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<TchList>(queryText: $"SELECT value(c) FROM c ",
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"TchList-{school.id}") }))
|
|
|
+ {
|
|
|
+ groups.Add(item.name);
|
|
|
+
|
|
|
+ tchLists.Add(item);
|
|
|
+ }
|
|
|
+ List<string> ids = tchLists.Select(x => x.id).ToList();
|
|
|
+ if (!ids.IsNotEmpty())
|
|
|
+ {
|
|
|
+ ids.Add("default");
|
|
|
+ }
|
|
|
+ (List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{school.id}");
|
|
|
+ //总人数
|
|
|
+ int teacherCount = tmdInfos.Count;
|
|
|
+ //参与人数
|
|
|
+ int joinCount = 0;
|
|
|
+ //能力点订阅数量
|
|
|
+ int subCount = 0;
|
|
|
+ //已完成50个学时的人数
|
|
|
+ int ok50TimeCount = 0;
|
|
|
+ //已完成能力点的校园评审数量
|
|
|
+ int hasScoreCount = 0;
|
|
|
+ //已经提交作品的数量
|
|
|
+ int hasSubmitCount = 0;
|
|
|
+ // 未提交的
|
|
|
+ int unSubmitCount = 0;
|
|
|
+ //未完成能力点学习未完成的
|
|
|
+ int unDoneCount = 0;
|
|
|
+ //合格的能力点作品数量
|
|
|
+ int okCount = 0;
|
|
|
+ int schoolVideoTime=0;
|
|
|
+
|
|
|
+ ///线上完成人数
|
|
|
+ int onlineTeacherCount = 0;
|
|
|
+ ///线下完成人数
|
|
|
+ int offlineTeacherCount = 0;
|
|
|
+ ///应用考核完成人数
|
|
|
+ int schoolScoreTeacherCount = 0;
|
|
|
+ //课堂实录完成人数
|
|
|
+ int classVideoTeacherCount = 0;
|
|
|
+ List<TeacherStatistic> groupMembers = new();
|
|
|
+ foreach (var tmd in tmdInfos)
|
|
|
+ {
|
|
|
+ await foreach (var sub in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<AbilitySub>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilitySub-{school.id}-{tmd.id}") }))
|
|
|
+ {
|
|
|
+ abilitySubs.Add(sub);
|
|
|
+ }
|
|
|
+ //List<StuActivity> stu = new List<StuActivity>();
|
|
|
+ //List<StuActivity> exam = new List<StuActivity>();
|
|
|
+ //List<StuActivity> survey = new List<StuActivity>();
|
|
|
+ //List<StuActivity> vote = new List<StuActivity>();
|
|
|
+ //总学时
|
|
|
+ int alltime = 0;
|
|
|
+ //已学习的能力点
|
|
|
+ int allAbilityCount = 0;
|
|
|
+ //获得的在线学时
|
|
|
+ int onlineTime = 0;
|
|
|
+ //获得的线下学时
|
|
|
+ int offlinelTime = 0;
|
|
|
+ //获得的作品提交,并通过学校评审的学时
|
|
|
+ int schoolScoreTime = 0;
|
|
|
+ //获得的课堂实录
|
|
|
+ int classVideoTime = 0;
|
|
|
+ //教师应提交的作品数量
|
|
|
+ int tchSubmitCount = 0;
|
|
|
+ //教师未提交的作品数量
|
|
|
+ int tchUnSubmitCount = 0;
|
|
|
+ //通过能力点自测的数量
|
|
|
+ int hasAbilityExercise = 0;
|
|
|
+ //教师订阅的能力点数量
|
|
|
+ int thcSubCount = 0;
|
|
|
+ //教师完成能力点学校的数量
|
|
|
+ int thcSubDoneCount = 0;
|
|
|
+ //参加校本线下研修的活动
|
|
|
+ int offlineSchoolCount = 0;
|
|
|
+ //参加区级线下研修的活动
|
|
|
+ int offlineAreaCount = 0;
|
|
|
+ //完成的校本线下研修活动
|
|
|
+ int offlineSchoolDoneCount = 0;
|
|
|
+ //完成的区级线下研修或的
|
|
|
+ int offlineAreaDoneCount = 0;
|
|
|
+
|
|
|
+ int examCount = 0;
|
|
|
+ int voteCount = 0;
|
|
|
+ int surveyCount = 0;
|
|
|
+ int examDoneCount = 0;
|
|
|
+ int voteDoneCount = 0;
|
|
|
+ int surveyDoneCount = 0;
|
|
|
+ int examAreaCount = 0;
|
|
|
+ int voteAreaCount = 0;
|
|
|
+ int surveyAreaCount = 0;
|
|
|
+ int examAreaDoneCount = 0;
|
|
|
+ int voteAreaDoneCount = 0;
|
|
|
+ int surveyAreaDoneCount = 0;
|
|
|
+
|
|
|
+
|
|
|
+ int videoTime = 0;
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Study' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{tmd.id}") }))
|
|
|
+ {
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ offlinelTime += 1;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(item.owner))
|
|
|
+ {
|
|
|
+ if (item.owner.Equals("school"))
|
|
|
+ {
|
|
|
+ offlineSchoolCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ offlineSchoolDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (item.owner.Equals("area"))
|
|
|
+ {
|
|
|
+ offlineAreaCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ offlineAreaDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'ExamLite' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{tmd.id}") }))
|
|
|
+ {
|
|
|
+ if (item.owner.Equals("school"))
|
|
|
+ {
|
|
|
+ examCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ examDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.owner.Equals("area"))
|
|
|
+ {
|
|
|
+ examAreaCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ examAreaDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Survey' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{tmd.id}") }))
|
|
|
+ {
|
|
|
+ if (item.owner.Equals("school"))
|
|
|
+ {
|
|
|
+ surveyCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ surveyDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.owner.Equals("area"))
|
|
|
+ {
|
|
|
+ surveyAreaCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ surveyAreaDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
+ .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Vote' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{tmd.id}") }))
|
|
|
+ {
|
|
|
+ if (item.owner.Equals("school"))
|
|
|
+ {
|
|
|
+ voteCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ voteDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.owner.Equals("area"))
|
|
|
+ {
|
|
|
+ voteAreaCount += 1;
|
|
|
+ if (item.taskStatus > 0)
|
|
|
+ {
|
|
|
+ voteAreaDoneCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bool isJoinVideo = false;
|
|
|
+ ClassVideo classVideo = classVideos.Find(x => x.id.Equals(tmd.id));
|
|
|
+ if (classVideo != null && classVideo.files.IsNotEmpty())
|
|
|
+ {
|
|
|
+ isJoinVideo = true;
|
|
|
+ classVideo.files.ForEach(x =>
|
|
|
+ {
|
|
|
+ if (x.score > 0)
|
|
|
+ {
|
|
|
+ classVideoTime += 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<SubStatistic> subs = new();
|
|
|
+ abilitySubs.Where(x => x.code.Equals($"AbilitySub-{school.id}-{tmd.id}")).ToList().ForEach(item =>
|
|
|
+ {
|
|
|
+ subCount += 1;
|
|
|
+ thcSubCount += 1;
|
|
|
+ if (item.exerciseScore > 0)
|
|
|
+ {
|
|
|
+ hasAbilityExercise += 1;
|
|
|
+ }
|
|
|
+ if (item.uploads.IsNotEmpty())
|
|
|
+ {
|
|
|
+ //已经有作品提交的
|
|
|
+ hasSubmitCount += 1;
|
|
|
+ tchSubmitCount += 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //未提交作品的
|
|
|
+ unSubmitCount += 1;
|
|
|
+ tchUnSubmitCount += 1;
|
|
|
+ }
|
|
|
+ if (!item.done)
|
|
|
+ {
|
|
|
+ unDoneCount += 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ thcSubDoneCount += 1;
|
|
|
+ }
|
|
|
+ allAbilityCount += item.abilityCount;
|
|
|
+ //onlineTime += item.hour;
|
|
|
+ int vtime = (int)item.videoRcds.Sum(x => x.time);
|
|
|
+ videoTime += vtime;
|
|
|
+ schoolVideoTime = schoolVideoTime + videoTime;
|
|
|
+ int lesson = vtime / setting.lessonMinutes;
|
|
|
+ onlineTime += lesson;
|
|
|
+ if (item.otherScore.IsNotEmpty())
|
|
|
+ {
|
|
|
+ var schoolScore = item.otherScore.Where(x => x.roleType.Equals("school")).FirstOrDefault();
|
|
|
+
|
|
|
+ if (schoolScore != null)
|
|
|
+ {
|
|
|
+ if (schoolScore.score > 0)
|
|
|
+ {
|
|
|
+ okCount += 1;
|
|
|
+ schoolScoreTime += 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ hasScoreCount += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Ability ability = abilities.Find(x => x.id.Equals(item.id));
|
|
|
+ subs.Add(new SubStatistic
|
|
|
+ {
|
|
|
+ abilityId = item.id,
|
|
|
+ code = item.code,
|
|
|
+ uploadCount = item.uploads.IsNotEmpty() ? item.uploads.Count : 0,
|
|
|
+ otherScoreCount = item.otherScore.IsNotEmpty() ? item.otherScore.Count : 0,
|
|
|
+ comidCount = 0,
|
|
|
+ self = item.self,
|
|
|
+ abilityName = ability.name,
|
|
|
+ no = ability.no,
|
|
|
+ dimension = ability.dimension,
|
|
|
+ env = ability.env
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //处理单项 超标准 学时
|
|
|
+ alltime += onlineTime >= setting.onlineTime ? setting.onlineTime : onlineTime;
|
|
|
+ alltime += offlinelTime >= setting.offlineTime ? setting.offlineTime : offlinelTime;
|
|
|
+ alltime += schoolScoreTime >= setting.submitTime ? setting.submitTime : schoolScoreTime;
|
|
|
+ alltime += classVideoTime >= setting.classTime ? setting.classTime : classVideoTime;
|
|
|
+
|
|
|
+ onlineTeacherCount = onlineTime >= setting.onlineTime ? onlineTeacherCount + 1: onlineTeacherCount;
|
|
|
+ offlineTeacherCount = offlinelTime >= setting.offlineTime ? offlineTeacherCount + 1: offlineTeacherCount;
|
|
|
+ schoolScoreTeacherCount = schoolScoreTime >= setting.submitTime ? schoolScoreTeacherCount+1: schoolScoreTeacherCount;
|
|
|
+ classVideoTeacherCount = classVideoTime >= setting.classTime ? classVideoTeacherCount+1: classVideoTeacherCount;
|
|
|
+
|
|
|
+ if (alltime >= setting.allTime)
|
|
|
+ {
|
|
|
+ ok50TimeCount += 1;
|
|
|
+ }
|
|
|
+ var classes = classInfos.Where(y => y.tmdInfos.Select(z => z.id).Contains(tmd.id)).ToList();
|
|
|
+
|
|
|
+ //表示有订阅,或者有线下活动参与的,或者有课堂实录视频上传的
|
|
|
+ if (subs.Count > 0 || schoolScoreTime > 0 || isJoinVideo)
|
|
|
+ {
|
|
|
+ //参训人数表示
|
|
|
+ joinCount += 1;
|
|
|
+ groupMembers.Add(new TeacherStatistic
|
|
|
+ {
|
|
|
+ tchSubmitCount = tchSubmitCount,
|
|
|
+ tchUnSubmitCount = tchUnSubmitCount,
|
|
|
+ thcSubCount = thcSubCount,
|
|
|
+ tmdname = tmd.name,
|
|
|
+ tmdid = tmd.id,
|
|
|
+ picture = tmd.picture,
|
|
|
+ groups = classes.Select(x => new TeacherGroup { groupId = x.id, groupName = x.name }).ToList(),
|
|
|
+ subs = subs,
|
|
|
+ alltime = alltime,
|
|
|
+ allAbilityCount = allAbilityCount,
|
|
|
+ onlineTime = onlineTime,
|
|
|
+ offlinelTime = offlinelTime,
|
|
|
+ schoolScoreTime = schoolScoreTime,
|
|
|
+ classVideoTime = classVideoTime,
|
|
|
+ hasAbilityExercise = hasAbilityExercise,
|
|
|
+ thcSubDoneCount = thcSubDoneCount,
|
|
|
+ offlineSchoolCount = offlineSchoolCount,
|
|
|
+ offlineAreaCount = offlineAreaCount,
|
|
|
+ offlineSchoolDoneCount = offlineSchoolDoneCount,
|
|
|
+ offlineAreaDoneCount = offlineAreaDoneCount,
|
|
|
+ examCount = examCount,
|
|
|
+ voteCount = voteCount,
|
|
|
+ surveyCount = surveyCount,
|
|
|
+ examDoneCount = examDoneCount,
|
|
|
+ voteDoneCount = voteDoneCount,
|
|
|
+ surveyDoneCount = surveyDoneCount,
|
|
|
+ examAreaCount = examAreaCount,
|
|
|
+ voteAreaCount = voteAreaCount,
|
|
|
+ surveyAreaCount = surveyAreaCount,
|
|
|
+ examAreaDoneCount = examAreaDoneCount,
|
|
|
+ voteAreaDoneCount = voteAreaDoneCount,
|
|
|
+ surveyAreaDoneCount = surveyAreaDoneCount,
|
|
|
+ videoTime = videoTime
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<DimensionCount> dimensionCount = new List<DimensionCount>();
|
|
|
+ foreach (var dms in dimensions)
|
|
|
+ {
|
|
|
+ var list = groupMembers.SelectMany(x => x.subs.Where(y => y.dimension.Equals(dms))).ToList();
|
|
|
+ dimensionCount.Add(new DimensionCount { dimension = dms, count = list.IsNotEmpty() ? list.Count : 0 });
|
|
|
+ }
|
|
|
+ List<AbilityCount> abilityCount = new List<AbilityCount>();
|
|
|
+ foreach (var abilityId in abilitieIds)
|
|
|
+ {
|
|
|
+ var list = groupMembers.SelectMany(x => x.subs.Where(y => y.abilityId.Equals(abilityId))).ToList();
|
|
|
+ Ability ability = abilities.Find(x => x.id.Equals(abilityId));
|
|
|
+ abilityCount.Add(new AbilityCount { abilityId = abilityId, abilityName = ability.name, dimension = ability.dimension, abilityNo = ability.no, abilityEnv = ability.env, count = list.IsNotEmpty() ? list.Count : 0 });
|
|
|
+ }
|
|
|
+ SchoolCount schoolCount = new SchoolCount {name=school.name,id=school.id,picture=school.picture,doneCount= ok50TimeCount , joinCount=joinCount};
|
|
|
+
|
|
|
+ yield return (groupMembers, dimensionCount, abilityCount, teacherCount, joinCount, subCount,
|
|
|
+ ok50TimeCount, hasScoreCount, hasSubmitCount, unDoneCount, unSubmitCount, okCount, schoolVideoTime, schoolCount,
|
|
|
+ onlineTeacherCount, offlineTeacherCount, schoolScoreTeacherCount, classVideoTeacherCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public record SchoolCount
|
|
|
+ {
|
|
|
+ public string name { get; set; }
|
|
|
+ public string id { get; set; }
|
|
|
+ public string picture { get; set; }
|
|
|
+ public int joinCount { get; set; }
|
|
|
+ public int doneCount { get; set; }
|
|
|
}
|
|
|
+ public record DimensionCount {
|
|
|
+ public string dimension { get; set; }
|
|
|
+
|
|
|
+ public int count { get; set; }
|
|
|
+ }
|
|
|
+ public record AbilityCount
|
|
|
+ {
|
|
|
+ public string abilityId { get; set; }
|
|
|
+ public string abilityName { get; set; }
|
|
|
+ public string dimension { get; set; }
|
|
|
+ public string abilityNo { get; set; }
|
|
|
+ public string abilityEnv { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+ public int count { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取订阅统计
|
|
|
/// </summary>
|
|
@@ -136,9 +586,8 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
}
|
|
|
if (!request.TryGetProperty("school", out JsonElement _school)) return BadRequest();
|
|
|
HashSet<string> dimensions = new HashSet<string>();
|
|
|
- HashSet<string> groups = new HashSet<string>();
|
|
|
- HashSet<string> groupNames = new HashSet<string>();
|
|
|
- Dictionary<string, string> groupDict = new Dictionary<string, string>();
|
|
|
+ List<KeyValuePair<string, string>> groups = new List<KeyValuePair<string, string>>();
|
|
|
+
|
|
|
List<Ability> abilities = new List<Ability>();
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal")
|
|
|
.GetItemQueryIterator<Ability>(queryText: $"select c.id, c.name,c.no,c.dimension, c.env from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{standard}") }))
|
|
@@ -161,8 +610,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<TchList>(queryText: $"SELECT value(c) FROM c ",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"TchList-{_school}") }))
|
|
|
{
|
|
|
- groups.Add(item.name);
|
|
|
- groupDict[item.name] = item.id;
|
|
|
+ groups.Add(new KeyValuePair<string, string>(item.id, item.name));
|
|
|
tchLists.Add(item);
|
|
|
}
|
|
|
List<string> ids = tchLists.Select(x => x.id).ToList();
|
|
@@ -228,13 +676,13 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
int examDoneCount = 0;
|
|
|
int voteDoneCount = 0;
|
|
|
int surveyDoneCount = 0;
|
|
|
-
|
|
|
int examAreaCount = 0;
|
|
|
int voteAreaCount = 0;
|
|
|
int surveyAreaCount = 0;
|
|
|
int examAreaDoneCount = 0;
|
|
|
int voteAreaDoneCount = 0;
|
|
|
int surveyAreaDoneCount = 0;
|
|
|
+ int videoTime = 0;
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
.GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Study' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{tmd.id}") }))
|
|
|
{
|
|
@@ -366,7 +814,11 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
thcSubDoneCount += 1;
|
|
|
}
|
|
|
allAbilityCount += item.abilityCount;
|
|
|
- onlineTime += item.hour;
|
|
|
+ //onlineTime += item.hour;
|
|
|
+ int vtime = (int)item.videoRcds.Sum(x => x.time);
|
|
|
+ videoTime += vtime;
|
|
|
+ int lesson = vtime / setting.lessonMinutes;
|
|
|
+ onlineTime += lesson;
|
|
|
if (item.otherScore.IsNotEmpty())
|
|
|
{
|
|
|
var schoolScore = item.otherScore.Where(x => x.roleType.Equals("school")).FirstOrDefault();
|
|
@@ -404,6 +856,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
alltime += offlinelTime >= setting.offlineTime ? setting.offlineTime : offlinelTime;
|
|
|
alltime += schoolScoreTime >= setting.submitTime ? setting.submitTime : schoolScoreTime;
|
|
|
alltime += classVideoTime >= setting.classTime ? setting.classTime : classVideoTime;
|
|
|
+
|
|
|
if (alltime >= setting.allTime)
|
|
|
{
|
|
|
ok50TimeCount += 1;
|
|
@@ -449,6 +902,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
examAreaDoneCount = examAreaDoneCount,
|
|
|
voteAreaDoneCount = voteAreaDoneCount,
|
|
|
surveyAreaDoneCount = surveyAreaDoneCount,
|
|
|
+ videoTime= videoTime
|
|
|
}) ;
|
|
|
}
|
|
|
}
|
|
@@ -463,10 +917,9 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
{
|
|
|
var list = groupMembers.SelectMany(x => x.subs.Where(y => y.abilityId.Equals(abilityId))).ToList();
|
|
|
Ability ability = abilities.Find(x => x.id.Equals(abilityId));
|
|
|
-
|
|
|
abilityCount.Add(new { abilityId = abilityId, abilityName = ability.name, dimension = ability.dimension, abilityNo = ability.no, abilityEnv = ability.env, count = list.IsNotEmpty() ? list.Count : 0 });
|
|
|
}
|
|
|
- return Ok(new { groupMembers, dimensionCount, abilityCount, teacherCount, joinCount, subCount, ok50TimeCount, hasScoreCount, hasSubmitCount, unDoneCount, unSubmitCount, okCount });
|
|
|
+ return Ok(new { groupMembers, dimensionCount, abilityCount, teacherCount, joinCount, subCount, ok50TimeCount, hasScoreCount, hasSubmitCount, unDoneCount, unSubmitCount, okCount, groups, setting });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -513,6 +966,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
public int examAreaDoneCount { get; set; }
|
|
|
public int voteAreaDoneCount { get; set; }
|
|
|
public int surveyAreaDoneCount { get; set; }
|
|
|
+ public int videoTime { get; set; }
|
|
|
}
|
|
|
public record SubStatistic
|
|
|
{
|
|
@@ -600,7 +1054,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
int surveyAreaDoneCount = 0;
|
|
|
int voteAreaDoneCount = 0;
|
|
|
int examAreaDoneCount = 0;
|
|
|
-
|
|
|
+ int videoTime = 0;
|
|
|
List<string> abilityIds = new List<string>();
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
.GetItemQueryIterator<AbilitySub>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilitySub-{_school}-{_tmdid}") }))
|
|
@@ -615,7 +1069,10 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
hasAbilityExercise += 1;
|
|
|
}
|
|
|
allAbilityCount += item.abilityCount;
|
|
|
- int lesson=(int) item.videoRcds.Sum(x => x.time)/setting.lessonMinutes;
|
|
|
+
|
|
|
+ int vtime = (int)item.videoRcds.Sum(x => x.time);
|
|
|
+ videoTime += vtime;
|
|
|
+ int lesson= vtime / setting.lessonMinutes;
|
|
|
onlineTime += lesson;
|
|
|
if (item.otherScore.IsNotEmpty())
|
|
|
{
|
|
@@ -790,6 +1247,8 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
voteAreaJoinCount,
|
|
|
examAreaJoinCount,
|
|
|
examAreaDoneCount,
|
|
|
+ videoTime,
|
|
|
+ setting
|
|
|
});
|
|
|
}
|
|
|
}
|