12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369 |
- using Azure;
- using Azure.Storage.Blobs.Models;
- using Microsoft.Extensions.Logging;
- using OfficeOpenXml;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Xml;
- using TEAMModelOS.SDK;
- using TEAMModelOS.SDK.DI;
- using TEAMModelOS.SDK.Extension;
- using TEAMModelOS.SDK.Models;
- namespace HTEX.Lib.ETL.Lesson
- {
- public class LessonETLService
- {
- /// <summary>
- /// 生成学生student-analysis.json
- /// </summary>
- /// <param name="objectiveTypes"></param>
- /// <param name="azureStorage"></param>
- /// <param name="lessonLocal"></param>
- /// <returns></returns>
- public static async Task DoStudentLessonData(List<string> objectiveTypes, AzureStorageFactory azureStorage, LessonLocal? lessonLocal)
- {
- List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
- studentLessonDatas = LessonETLService.GetIRSData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.irsDatas, studentLessonDatas, lessonLocal.examDatas,lessonLocal?.lessonRecord?.id);
- studentLessonDatas = LessonETLService.GetCoworkData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.coworkDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
- studentLessonDatas = LessonETLService.GetExamData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.examDatas, studentLessonDatas, objectiveTypes, lessonLocal.lessonRecord.id);
- studentLessonDatas = LessonETLService.GetSmartRatingData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.smartRatingDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
- studentLessonDatas = LessonETLService.GetTaskData(lessonLocal.lessonBase!, lessonLocal.timeLineData!, lessonLocal.taskDatas, studentLessonDatas, lessonLocal.lessonRecord.id);
- string owner = lessonLocal.lessonRecord.scope.Equals("school") ? lessonLocal.lessonRecord.school : lessonLocal.lessonRecord.tmdid;
- if (!azureStorage.GetBlobContainerClient(owner).GetBlobClient($"records/{lessonLocal.lessonRecord.id}/student-analysis.json").Exists())
- {
- await azureStorage.GetBlobContainerClient(owner).UploadFileByContainer(studentLessonDatas.ToJsonString(), "records", $"{lessonLocal.lessonRecord.id}/student-analysis.json");
- }
- }
- public static async IAsyncEnumerable<LessonLocal> GetLessonLocal(List<LessonRecord> lessonRecords, List<string> localIds, AzureStorageFactory _azureStorage,string pathLessons)
- {
- foreach (var lessonRecord in lessonRecords)
- {
- string scope = lessonRecord.scope;
- string owner = lessonRecord.scope.Equals("school") ? lessonRecord.school : lessonRecord.tmdid;
- if (localIds.Contains(lessonRecord.id))
- {
- continue;
- }
- string yearMonthPath = DateTimeOffset.FromUnixTimeMilliseconds(lessonRecord.startTime).ToString("yyyyMM");
- LessonLocal lessonLocal = new LessonLocal { lessonRecord=lessonRecord };
- if (System.IO.File.Exists($"{pathLessons}\\MM{yearMonthPath}\\{lessonRecord.id}-local.json"))
- {
- string jsonp = await System.IO.File.ReadAllTextAsync($"{pathLessons}\\MM{yearMonthPath}\\{lessonRecord.id}-local.json");
- lessonLocal = jsonp.ToObject<LessonLocal>();
- }
- else
- {
- List<string> files = new List<string>()
- {
- $"/records/{lessonRecord.id}/IES/TimeLine.json",
- $"/records/{lessonRecord.id}/IES/base.json",
- $"/records/{lessonRecord.id}/IES/Task.json",
- $"/records/{lessonRecord.id}/IES/SmartRating.json",
- $"/records/{lessonRecord.id}/IES/IRS.json",
- $"/records/{lessonRecord.id}/IES/Cowork.json",
- $"/records/{lessonRecord.id}/Sokrates/SokratesRecords.json",
- };
- lessonLocal = new LessonLocal { lessonRecord=lessonRecord };
- lessonLocal = await GetLessonFiles(lessonLocal, files, owner,_azureStorage);
- }
- if (lessonLocal.lessonBase!=null && lessonLocal.lessonBase.student!=null)
- {
- var baseData = GetBaseData(lessonLocal.lessonBase!);
- lessonLocal.studentLessonDatas= baseData.studentLessonDatas;
- List<ExamData> examDatas = await GetExamInfo(lessonRecord, lessonLocal.timeLineData,_azureStorage,owner );
- lessonLocal.examDatas = examDatas;
- lessonLocal.sokratesDatas= lessonLocal.sokratesDatas.IsNotEmpty() ? lessonLocal.sokratesDatas : lessonLocal.timeLineData!=null ? lessonLocal.timeLineData.events : new List<TimeLineEvent>();
- }
- yield return lessonLocal;
- }
- }
- private static async Task<LessonLocal> GetLessonFiles(LessonLocal lessonLocal, List<string> files, string owner, AzureStorageFactory _azureStorage)
- {
- await Parallel.ForEachAsync(files, async (file, _) =>
- {
- try
- {
- var exists = _azureStorage.GetBlobContainerClient(owner).GetBlobClient(file).Exists();
- if (exists)
- {
- BlobDownloadResult blobDownloadResult = await _azureStorage.GetBlobContainerClient(owner).GetBlobClient(file).DownloadContentAsync();
- switch (true)
- {
- case bool when file.Contains("IES/TimeLine.json"):
- lessonLocal.timeLineData= blobDownloadResult.Content.ToObjectFromJson<TimeLineData>();
- break;
- case bool when file.Contains("IES/base.json"):
- lessonLocal.lessonBase= blobDownloadResult.Content.ToObjectFromJson<LessonBase>();
- break;
- case bool when file.Contains("IES/Task.json"):
- lessonLocal.taskDatas= blobDownloadResult.Content.ToObjectFromJson<List<TaskData>>();
- break;
- case bool when file.Contains("IES/SmartRating.json"):
- lessonLocal.smartRatingDatas= blobDownloadResult.Content.ToObjectFromJson<List<SmartRatingData>>();
- break;
- case bool when file.Contains("IES/IRS.json"):
- lessonLocal.irsDatas= blobDownloadResult.Content.ToObjectFromJson<List<IRSData>>();
- break;
- case bool when file.Contains("IES/Cowork.json"):
- lessonLocal.coworkDatas= blobDownloadResult.Content.ToObjectFromJson<List<CoworkData>>();
- break;
- case bool when file.Contains("Sokrates/SokratesRecords.json"):
- lessonLocal.sokratesDatas= blobDownloadResult.Content.ToObjectFromJson<List<TimeLineEvent>>();
- break;
- }
- }
- }
- catch (RequestFailedException ex)
- {
- Console.WriteLine($"{file},{ex.Message},{ex.StackTrace}");
- }
- catch (Exception ex)
- {
- Console.WriteLine($"{file},{ex.Message},{ex.StackTrace}");
- }
- });
- return lessonLocal;
- }
- /// <summary>
- /// 处理base.json的数据
- /// </summary>
- /// <param name="lessonRecord"></param>
- /// <param name="lessonBase"></param>
- /// <returns></returns>
- public static (LessonBase lessonBase, List<LocalStudent> studentLessonDatas) GetBaseData(LessonBase lessonBase)
- {
- //处理学生定位数据
- List<LocalStudent> studentLessonDatas = new List<LocalStudent>();
- int index = 0;
- try
- {
- if (lessonBase!=null)
- {
- lessonBase.student.ForEach(x =>
- {
- int attend = 0;
- var client = lessonBase.report.clientSummaryList.Find(y => y.seatID == x.seatID);
- if (client!=null)
- {
- attend=client.attendState;
- }
- studentLessonDatas.Add(new LocalStudent()
- {
- id = x.id,
- index = index,
- seatID =$"{x.seatID}",
- groupId = x.groupId,
- attend= attend
- });
- index++;
- });
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(lessonBase.ToJsonString());
- }
- return (lessonBase, studentLessonDatas);
- }
- /// <summary>
- ///读取互动信息
- ///Event 过滤类型 'PopQuesLoad', 'ReAtmpAnsStrt', 'BuzrAns','BuzrLoad'
- /// 在IRS.json处理 'PopQuesLoad'互动问答 , 'ReAtmpAnsStrt' 二次作答 , 'BuzrAns' 抢权(新), 'BuzrLoad'抢权(旧)
- ///TimeLine.json 中找到对应类型,根据Pgid 去 IRS.json 中找到对应数据,从clientAnswers 的下标对应 base.json 中的 student 找到对应学生信息 clientAnswers.length > 1 则表示有二次作答
- ///读取IRS.json
- /// </summary>
- /// <param name="lessonBase"></param>
- /// <param name="timeLineData"></param>
- /// <param name="irsDatas"></param>
- /// <param name="studentLessonDatas"></param>
- /// <param name="examDatas"></param>
- /// <param name="itemFiles"></param>
- /// <returns></returns>
- public static List<StudentLessonData> GetIRSData(LessonBase lessonBase, TimeLineData timeLineData, List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas, List<ExamData> examDatas,string lessonId)
- {
- List<string> interactTypes = new List<string>() { "PopQuesLoad", "ReAtmpAnsStrt", "BuzrAns", "BuzrLoad" };
- //去重页面
- var enventsInteract = timeLineData?.events?.Where(x => !string.IsNullOrWhiteSpace(x.Pgid) && interactTypes.Contains(x.Event)).GroupBy(x => x.Pgid).Select(x => new { key = x.Key, list = x.ToList() });
- if (enventsInteract!= null && enventsInteract.Count()>0)
- {
- var keys = enventsInteract.Select(x => x.key).ToList();
- foreach (var item in enventsInteract)
- {
- ProcessIRSPageData(irsDatas, studentLessonDatas, examDatas, item);
- }
- //处理其他,评测类型的互动,因为有可能不会记录在TimeLine.json中
- var envents_other = timeLineData.events.Where(x => !string.IsNullOrWhiteSpace(x.Pgid) && !keys.Contains(x.Pgid)).GroupBy(x => x.Pgid).Select(x => new { key = x.Key, list = x.ToList() });
- if (envents_other!=null && envents_other.Count()>0)
- {
- foreach (var item in envents_other)
- {
- ProcessIRSPageData(irsDatas, studentLessonDatas, examDatas, item);
- }
- }
- }
- else
- {
- //处理其他,评测类型的互动,因为有可能不会记录在TimeLine.json中
- if (timeLineData!=null)
- {
- var envents_other = timeLineData.events.Where(x => !string.IsNullOrWhiteSpace(x.Pgid)).GroupBy(x => x.Pgid).Select(x => new { key = x.Key, list = x.ToList() });
- if (envents_other!=null && envents_other.Count()>0)
- {
- foreach (var item in envents_other)
- {
- ProcessIRSPageData(irsDatas, studentLessonDatas, examDatas, item);
- }
- }
- }
- else
- {
- foreach (var item in irsDatas.Select(x => x.pageID))
- {
- ProcessIRSPageData(irsDatas, studentLessonDatas, examDatas, new { key = item });
- }
- }
- }
- //单独处理挑人的逻辑
- //是否从小组里面挑人。
- //不需要去重页面,直接获取挑人大类 PickupResult
- //小类处理:PickupRight , PickupOption , PickupNthGrp ,PickupEachGrp ,PickupDiff , PickupResult 挑人算不算互动?? 读取PickupMemberId "[\r\n 35\r\n]"
- var enventsPickup = timeLineData?.events.Where(x => !string.IsNullOrWhiteSpace(x.Pgid) && x.Event.Equals("PickupResult"));
- if (enventsPickup.IsNotEmpty())
- {
- foreach (var item in enventsPickup)
- {
- List<int> mbrs = item.PickupMemberId.ToObject<List<int>>();
- // 挑人挑中 TT ,没有挑中 T1
- foreach (var studentLessonData in studentLessonDatas)
- {
- var mbr = mbrs.FindAll(x => studentLessonData.seatID!.Equals($"{x}"));
- if (mbr.IsNotEmpty())
- {
- foreach (var m in mbr)
- {
- studentLessonData.attend=1;
- //studentLessonData.interactRecord.interactRecords.Add(new ItemRecord()
- //{
- // resultWeight = InteractWeight.TT,
- // resultType=InteractReultType.TT,
- // itemType = string.IsNullOrWhiteSpace(item.PickupType) ? "PickupResult" : item.PickupType
- //});
- studentLessonData.pickups.Add(string.IsNullOrWhiteSpace(item.PickupType) ? "1--PickupResult" : $"1--{item.PickupType}");
- }
- }
- else
- {
- //处理未挑中的
- if (studentLessonData.attend==1)
- {
- studentLessonData.pickups.Add(string.IsNullOrWhiteSpace(item.PickupType) ? "0--PickupResult" : $"0--{item.PickupType}");
- }
- }
- }
- }
- }
- return studentLessonDatas;
- }
- private static List<StudentLessonData> ProcessIRSPageData(List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas, List<ExamData> examDatas, dynamic item)
- {
- var irsDataPages = irsDatas.Where(y => item.key.Equals(y.pageID));
- foreach (var irsDataPage in irsDataPages)
- {
- //检查是否设置正确答案。
- var answers_q = irsDataPage.question?["exercise"]?["answer"]?.ToJsonString().ToObject<List<string>>();
- //根据题去找对应的试卷和评测信息
- var question_id = $"{irsDataPage.question?["id"]}";
- var examData = examDatas.Where(x => x.paper!=null && x.paper.slides.Exists(x => !string.IsNullOrWhiteSpace(x.url) && x.url.Equals($"{question_id}.json"))).FirstOrDefault();
- List<string> answers = new List<string>();
- answers_q?.ForEach(x => {
- if (!string.IsNullOrWhiteSpace(x))
- {
- answers.Add(x);
- }
- });
- var _objective = irsDataPage.question?["exercise"]?["objective"];
- var scoreNode = irsDataPage.question?["exercise"]?["score"];
- var _type = irsDataPage.question?["exercise"]?["type"];
- var _answerType = irsDataPage.question?["exercise"]?["answerType"];//file,audio,text,image
- var qitem = irsDataPage.question?["item"]?.AsArray();
- if (qitem!=null && qitem.Count()>0)
- {
- for (var i = 0; i<qitem.Count(); i++)
- {
- qitem[i]!["question"]="";
- }
- }
- double questionScore = 0;
- bool objective = false;
- if (_objective!=null)
- {
- objective = _objective.GetValue<bool>();
- }
- //题型
- string type = string.Empty;
- if (_type!=null)
- {
- //题型
- type = _type.GetValue<string>();
- List<string> types = new List<string>() { "single", "multiple", "judge", "sortmultiple" };
- if (types.Contains(type))
- {
- objective = true;
- }
- else
- {
- objective = false;
- }
- }
- if (_answerType!=null)
- {
- _answerType.GetValue<string>();
- //暂不处理,可能存在依然传文字的情况
- //不是文本作答的处理,题目不是客观题,答案不记录
- //if (!_answerType.Equals("text"))
- //{
- // objective=false;
- // answers=new List<string>();
- //}
- }
- if (scoreNode!=null)
- {
- double.TryParse(scoreNode.ToString(), out questionScore);
- }
- string interactType = string.Empty;
- if (irsDataPage.clientAnswers.IsNotEmpty())
- {
- //第一个list是几轮,一次作答,二次作答, 第二个list是学生的下标, 第三个list是 答案
- List<List<List<string>>> clientAnswers = new List<List<List<string>>>();
- foreach (var key in irsDataPage.clientAnswers.Keys)
- {
- clientAnswers.Add(irsDataPage.clientAnswers[key]);
- }
- // 获取第一个列表的长度作为比较基准
- int firstListLength = clientAnswers.First().Count;
- bool isSameLength = true;
- // 遍历剩余的列表并检查它们的长度是否与第一个列表相同
- foreach (var innerList in clientAnswers.Skip(1))
- {
- if (innerList.Count != firstListLength)
- {
- isSameLength = false;
- break;
- }
- }
- //并检查学生集合的长度是否与第一个列表相同
- if (isSameLength && studentLessonDatas.Count()==firstListLength)
- {
- for (int index = 0; index< clientAnswers[0].Count; index++)
- {
- var student = studentLessonDatas[index];
- double studentScore = 0;
- if (examData!=null && examData.examClassResult.IsNotEmpty())
- {
- var examResultIndex = examData.examClassResult.First().studentIds.IndexOf(student.id);
- var questionIndex = examData.paper.slides.Select(x => x.url).ToList().IndexOf($"{question_id}.json");
- if (examResultIndex>=0
- && examData.examClassResult.First().studentScores.Count>=(examResultIndex+1) //防止索引越界
- && examData.examClassResult.First().studentScores[examResultIndex].Count>=(questionIndex+1)) //防止索引越界
- {
- //获取index学生在questionIndex题的分数
- studentScore = examData.examClassResult.First().studentScores[examResultIndex][questionIndex];
- }
- }
- //index 代表学生下标
- List<ItemRecord> interactRecords = new List<ItemRecord>();
- if (clientAnswers.Count==1)
- {
- //即问即答
- interactType = "PopQuesLoad";
- var ans0 = clientAnswers[0][index];
- var IS0 = GetInteractResultHasAnswer(answers, ans0, objective, type, questionScore, studentScore);
- interactRecords.Add(new ItemRecord()
- {
- resultWeight = IS0.weight,
- resultType=IS0.reultType,
- itemType= interactType,
- criterion= questionScore,
- itemScore= IS0.interactScore
- });
- }
- if (clientAnswers.Count==2)
- {
- //二次作答
- interactType="ReAtmpAnsStrt";
- var ans1 = clientAnswers[1][index];
- var IS1 = GetInteractResultHasAnswer(answers, ans1, objective, type, questionScore, studentScore);
- interactRecords.Add(new ItemRecord()
- {
- resultWeight = IS1.weight,
- resultType=IS1.reultType,
- itemType= interactType,
- criterion= questionScore,
- itemScore= IS1.interactScore
- });
- }
- if (clientAnswers.Count>2)
- {
- //三次作答
- interactType="TeAtmpAnsStrt";
- var ans2 = clientAnswers[2][index];
- var IS2 = GetInteractResultHasAnswer(answers, ans2, objective, type, questionScore, studentScore);
- interactRecords.Add(new ItemRecord()
- {
- resultWeight = IS2.weight,
- resultType=IS2.reultType,
- itemType= interactType,
- criterion= questionScore,
- itemScore= IS2.interactScore
- });
- }
- if (studentLessonDatas[index].attend==1)
- {
- studentLessonDatas[index].interactRecord.interactRecords.AddRange(interactRecords);
- }
- }
- }
- }
- //是否抢权作答的模式
- if (irsDataPage.isBuzz)
- {
- interactType = "BuzrAns";
- //处理参与抢权的
- Dictionary<string, ItemRecord> buzzParticipants = new Dictionary<string, ItemRecord>();
- foreach (var buzzParticipant in irsDataPage.buzzParticipants)
- {
- var studentData = studentLessonDatas.Find(x => x.seatID!.Equals(buzzParticipant));
- if (studentData != null)
- {
- buzzParticipants[buzzParticipant]=new ItemRecord() { resultWeight = InteractWeight.T1, itemType= interactType, resultType= InteractReultType.T1 };
- }
- }
- //处理抢权成功的
- foreach (var buzzClient in irsDataPage.buzzClients)
- {
- buzzParticipants[buzzClient]=new ItemRecord() { resultWeight = InteractWeight.TT, itemType= interactType, resultType= InteractReultType.TT };
- }
- foreach (var studentLessonData in studentLessonDatas)
- {
- if (buzzParticipants.ContainsKey(studentLessonData.seatID!))
- {
- //处理已经有抢权结果的数据
- studentLessonData.attend=1;
- studentLessonData.interactRecord.interactRecords.Add(buzzParticipants[studentLessonData.seatID!]);
- }
- else
- {
- if (studentLessonData.attend==1)
- {
- //处理未参与抢权的
- studentLessonData.interactRecord.interactRecords.Add(new ItemRecord() { resultWeight = InteractWeight.T0, itemType = interactType, resultType= InteractReultType.T0 });
- }
- }
- }
- }
- }
- return studentLessonDatas;
- }
- private static (double weight, string reultType, double interactScore) GetInteractResultHasAnswer(List<string>? answers, List<string> ans0, bool objective, string type, double questionScore, double studentScore)
- {
- //List<string> ans0 = new List<string>();
- //ans?.ForEach(x => {
- // if (!string.IsNullOrWhiteSpace(x))
- // {
- // ans0.Add(x);
- // }
- // else { ans.Add("");}
- //});
- double weight = InteractWeight.T0;
- string reultType = InteractReultType.T0;
- double interactScore = 0;
- if (answers.IsNotEmpty())
- {
- if (ans0.IsNotEmpty())
- {
- if (objective) //客观题
- {
- //标准答案等于作答的结果
- if (answers!.Count == ans0.Count)
- {
- if (answers.All(item => ans0.Contains(item)))
- {
- //完全正确
- weight= InteractWeight.TT;
- reultType= InteractReultType.TT;
- interactScore= studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- //作答错误
- weight= InteractWeight.T1;
- reultType = InteractReultType.T1;
- interactScore= studentScore;
- }
- }
- //标准答案比作答的结果多
- else if (answers!.Count > ans0.Count)
- {
- if (ans0.All(item => answers.Contains(item)))
- {
- //部分正确
- weight= InteractWeight.TP;
- reultType = InteractReultType.TP;
- // 2 * 0.3 * 10= 6
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- else
- {
- //作答错误
- weight= InteractWeight.T1;
- reultType = InteractReultType.T1;
- interactScore= studentScore;
- }
- }
- //标准答案比作答结果少
- else
- {
- //作答错误
- weight= InteractWeight.T1;
- reultType = InteractReultType.T1;
- interactScore= studentScore;
- }
- }
- else
- {
- //填空题
- if ("complete".Equals(type) && answers!.Count==ans0.Count)
- {
- bool hasT = false;
- bool hasF = false;
- for (int i = 0; i < answers!.Count; i++)
- {
- if (answers[i].Equals(ans0[i]))
- {
- hasT=true;
- }
- else
- {
- hasF=true;
- }
- }
- if (hasT && !hasF)
- {
- //完全正确
- weight= InteractWeight.TT;
- reultType = InteractReultType.TT;
- interactScore= studentScore==0 ? questionScore : studentScore;
- }
- else if (hasT && hasF)
- {
- //部分正确
- weight= InteractWeight.TP;
- reultType = InteractReultType.TP;
- // 2 * 0.3 * 10= 6
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- else if (!hasT && hasF)
- {
- //没有正确的,但有错误的,代表参与了
- weight= InteractWeight.T1;
- reultType = InteractReultType.T1;
- interactScore= studentScore;
- }
- else if (!hasT && !hasF)
- {
- //没有正确的,也没有错误的,代表没有作答
- weight= InteractWeight.T0;
- reultType = InteractReultType.T0;
- interactScore= studentScore;
- }
- }
- else
- {
- //主观题,完全匹配的
- if (answers!.All(item => ans0.Contains(item)))
- {
- //完全正确
- weight= InteractWeight.TT;
- reultType = InteractReultType.TT;
- interactScore= studentScore==0 ? questionScore : studentScore;
- }
- else
- { // 使用LINQ查询来判断是否有匹配的答案
- bool hasMatchingAnswer = answers!.Intersect(ans0).Any();
- if (hasMatchingAnswer)
- {
- //主观题回答正确即为完全正确
- weight= InteractWeight.TT;
- reultType = InteractReultType.TT;
- interactScore= studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- //优先根据得分与标准分的占比算出得分率,如果没有得分率,如果是直接从互动,不知道是评测的 需要先去评测找作答得分。,则采用Levenshtein距离来评估两个字符串的相似度
- //没有匹配上答案,则采用Levenshtein距离来评估两个字符串的相似度
- if (questionScore>0)
- {
- if (studentScore>0)
- {
- weight = studentScore * 1.0 / questionScore* (InteractWeight.TT-InteractWeight.T1);
- if (weight==InteractWeight.T1)
- {
- reultType = InteractReultType.T1;
- interactScore=studentScore;
- }
- else if (weight>InteractWeight.TT)
- {
- reultType = InteractReultType.TT;
- interactScore=studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- reultType = InteractReultType.TP;
- // 2 * 0.3 * 10= 6
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- }
- else
- {
- weight=InteractWeight.T1+(CalculateSimilarity(answers![0], ans0[0]) *(InteractWeight.TT-InteractWeight.T1));
- if (weight==InteractWeight.T1)
- {
- reultType = InteractReultType.T1;
- interactScore=studentScore;
- }
- else if (weight>InteractWeight.TT)
- {
- reultType = InteractReultType.TT;
- interactScore=studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- reultType = InteractReultType.TP;
- // 2 * 0.3 * 10= 6
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- }
- }
- else
- {
- weight=InteractWeight.T1+(CalculateSimilarity(answers![0], ans0[0]) *(InteractWeight.TT-InteractWeight.T1));
- if (weight==InteractWeight.T1)
- {
- reultType = InteractReultType.T1;
- interactScore=studentScore;
- }
- else if (weight>InteractWeight.TT)
- {
- reultType = InteractReultType.TT;
- interactScore=studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- reultType = InteractReultType.TP;
- // 2 * 0.3 * 10= 6
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- }
- }
- }
- }
- }
- }
- else
- {
- //没有作答
- weight= InteractWeight.T0;
- reultType = InteractReultType.T0;
- interactScore=studentScore;
- }
- }
- else
- {
- //没有标准答案的情况
- if (ans0.IsNotEmpty())
- {
- bool hasAns = false;
- ans0.ForEach(x => {
- if (!string.IsNullOrWhiteSpace(x))
- {
- hasAns = true;
- }
- });
- if (hasAns)
- {
- //作答了
- weight= InteractWeight.T1;
- reultType = InteractReultType.T1;
- interactScore=studentScore;
- }
- else
- {
- //没有作答
- weight= InteractWeight.T0;
- reultType = InteractReultType.T0;
- interactScore=studentScore;
- }
- }
- else
- {
- //没有作答
- weight= InteractWeight.T0;
- reultType = InteractReultType.T0;
- interactScore=studentScore;
- }
- //如果教师手动给了分或AI评分
- if (questionScore>0 && studentScore>0)
- {
- weight = studentScore * 1.0 / questionScore* (InteractWeight.TT-InteractWeight.T1);
- if (weight==InteractWeight.T1)
- {
- reultType = InteractReultType.T1;
- interactScore=studentScore;
- }
- else if (weight>InteractWeight.TT)
- {
- reultType = InteractReultType.TT;
- interactScore=studentScore==0 ? questionScore : studentScore;
- }
- else
- {
- reultType = InteractReultType.TP;
- interactScore= studentScore==0 ? 1/(InteractWeight.TT-InteractWeight.T1) * (InteractWeight.TP-InteractWeight.T1) * questionScore : studentScore;
- }
- }
- }
- return (weight, reultType, interactScore);
- }
- /// <summary>
- /// C# 代码 如何判断两句话是否一个意思,非机器学习的算法。使用Levenshtein距离来评估两个字符串的相似度,但是不能判断它们是否表达了同一个意思,后续借助AI实现
- /// </summary>
- /// <param name="s1"></param>
- /// <param name="s2"></param>
- /// <returns></returns>
- public static double CalculateSimilarity(string s1, string s2)
- {
- int n = s1.Length;
- int m = s2.Length;
- int[,] d = new int[n + 1, m + 1];
- for (int i = 0; i <= n; i++)
- {
- d[i, 0] = i;
- }
- for (int j = 0; j <= m; j++)
- {
- d[0, j] = j;
- }
- for (int i = 1; i <= n; i++)
- {
- for (int j = 1; j <= m; j++)
- {
- int cost = (s1[i - 1] == s2[j - 1]) ? 0 : 1;
- d[i, j] = Math.Min(Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1), d[i - 1, j - 1] + cost);
- }
- }
- return (1.0 - ((double)d[n, m] / Math.Max(s1.Length, s2.Length)));
- }
- public static async Task<List<ExamData>> GetExamInfo(LessonRecord item, TimeLineData? timeLineData, AzureStorageFactory _azureStorage/*,ILogger<LessonETLService> _logger*/,string owner )
- {
- //读取ExamData
- List<ExamData> examDatas = new List<ExamData>();
- try
- {
- var examPages = timeLineData?.events.Where(x => !string.IsNullOrWhiteSpace(x.Pgid) && !string.IsNullOrWhiteSpace(x.ExamId));
- if (examPages!=null && examPages.Count()>0)
- {
- var examsFiles = await _azureStorage.GetBlobContainerClient(owner).List($"records/{item.id}/Exam");
- var paperFiles = await _azureStorage.GetBlobContainerClient(owner).List($"records/{item.id}/ExamPaper");
- foreach (var examsFile in examsFiles)
- {
- if (examsFile.EndsWith("Exam.json"))
- {
- ExamData? examData = null;
- try
- {
- BlobDownloadResult examDataDownload = await _azureStorage.GetBlobContainerClient(owner).GetBlobClient(examsFile).DownloadContentAsync();
- var str = examDataDownload.Content.ToString().Replace("\r\n", "").Replace("\ufeff", "").Replace("\"publish\": \"0\"", "\"publish\": 0").Replace("\"publish\": \"1\"", "\"publish\": 1");
- examData= str.ToObject<ExamData>();
- // examData = examDataDownload.Content.ToObjectFromJson<ExamData>();
- }
- catch (Exception ex)
- {
- if (!ex.Message.Contains("The specified blob does not exist"))
- {
- // _logger.LogError(ex, $"文件不存在:{examsFile}");
- }
- }
- if (examData!=null && examData.exam.papers.IsNotEmpty())
- {
- string paperId = examData.exam.papers.First().id;
- if (_azureStorage.GetBlobContainerClient(owner).GetBlobClient($"/records/{item.id}/ExamPaper/{paperId}/index.json").Exists())
- {
- LessonPaper lessonPaper = null;
- try
- {
- BlobDownloadResult paperblobDownload = await _azureStorage.GetBlobContainerClient(owner).GetBlobClient($"/records/{item.id}/ExamPaper/{paperId}/index.json").DownloadContentAsync();
- lessonPaper = paperblobDownload.Content.ToObjectFromJson<LessonPaper>();
- examData.paper = lessonPaper;
- }
- catch (Exception ex)
- {
- if (!ex.Message.Contains("The specified blob does not exist"))
- {
- // _logger.LogError(ex, $"文件不存在:/records/{item.id}/ExamPaper/{paperId}/index.json");
- }
- }
- }
- examDatas.Add(examData);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- // _logger.LogError(ex, ex.Message);
- }
- return examDatas;
- }
- /// <summary>
- /// 获取课中评测数据
- /// </summary>
- /// <param name="lessonBase"></param>
- /// <param name="timeLineData"></param>
- /// <param name="examDatas"></param>
- /// <param name="studentLessonDatas"></param>
- /// <param name="objectiveTypes"></param>
- /// <returns></returns>
- public static List<StudentLessonData> GetExamData(LessonBase lessonBase, TimeLineData timeLineData, List<ExamData> examDatas, List<StudentLessonData> studentLessonDatas, List<string> objectiveTypes, string lessonId)
- {
- foreach (var examData in examDatas)
- {
- //直接取第一个元素的试卷,因为在HiTeach中,只会是一个试卷(一个科目),一个班参与。
- var allocation = examData?.exam?.papers?.FirstOrDefault()?.point?.Sum();
- var answersStd = examData?.exam?.papers?.FirstOrDefault()?.answers;
- List<List<string>> answers = new List<List<string>>();
- if (answersStd!=null)
- {
- answersStd.ForEach(x => //去除[""]此种类型的标准答案,转为[]
- {
- List<string> ans = new List<string>();
- if (x.Count!=0)
- {
- if (x.Count==1)
- {
- if (string.IsNullOrWhiteSpace(x[0]))
- {
- answers.Add(ans);
- }
- else
- {
- answers.Add(x);
- }
- }
- else
- {
- answers.Add(x);
- }
- }
- else
- {
- answers.Add(ans);
- }
- });
- }
- examData?.examClassResult?.ForEach(item => {
- //学生下标
- int index = 0;
- if (item.studentAnswersArray.Count()>0
- && item.studentAnswersArray.Count() == item.studentIds.Count() //学生作答数量和学生id数量一致
- && item.studentScores.Count()==item.studentIds.Count()) //学生分数和学生id数量一致
- {
- item.studentAnswersArray.ForEach(stu => {
- var student = studentLessonDatas.Find(x => x.id!.Equals(item.studentIds[index]));
- if (student!=null && student.attend==1)
- {
- //是否要判断主观题或者客观题, 多套试卷,有主观题的
- //,如果没获得结果,
- //主观题有回答的:608942756458532864\Clients\18782481024\Ans\27-4341670635487887360-examExchangeAnswerlist
- //27 从1开始的学生序号-4341670635487887360评测编号,内容qNo 是从1开始的题号。
- if (stu.IsNotEmpty() && answers.Count()==stu.Count && examData.exam.papers[0].type.Count()==answers.Count)
- {
- StudentExamRecord studentExam = new StudentExamRecord();
- var studentScore = item.studentScores[index];
- List<ItemRecord> answerRecords = new List<ItemRecord>();
- //题目下标
- int itemIndex = 0;
- stu.ForEach(ans =>
- {
- bool objective = objectiveTypes.Contains(examData.exam.papers[0].type[itemIndex]);
- var questionScore = examData.exam.papers[0].point[itemIndex];
- string type = examData.exam.papers[0].type[itemIndex];
- var res = GetInteractResultHasAnswer(answers[itemIndex], ans, objective, type, questionScore, studentScore[itemIndex]);
- ItemRecord interactRecord = new ItemRecord()
- {
- itemType="SPQStrt",//类型
- resultType=res.reultType,//作答结果类型
- resultWeight=res.weight,//得分权重
- criterion= questionScore,//标准分
- itemScore= studentScore[itemIndex]//得分
- };
- answerRecords.Add(interactRecord);
- itemIndex++;
- });
- studentExam.score= answerRecords.Where(x => x.itemScore>=0).Select(x => x.itemScore).Sum();//得分
- studentExam.scoreRate= allocation.HasValue && allocation.Value>0 ? studentExam.score * 1.0/allocation.Value : 0;//得分率
- studentExam.answerRate= answerRecords.Where(x => x.resultWeight>0).Count()*1.0/studentScore.Count();//作答率
- studentExam.examId=examData.exam.id;
- studentExam.itemRecords=answerRecords;
- student.examRecords.Add(studentExam);
- }
- }
- index++;
- });
- }
- });
- }
- return studentLessonDatas;
- }
- /// <summary>
- /// 协作参与率 态度计算
- /// </summary>
- /// <param name="lessonBase"></param>
- /// <param name="timeLineData"></param>
- /// <param name="coworkDatas"></param>
- /// <param name="studentLessonDatas"></param>
- /// <param name="lessonId"></param>
- /// <returns></returns>
- public static List<StudentLessonData> GetCoworkData(LessonBase lessonBase, TimeLineData timeLineData, List<CoworkData> coworkDatas, List<StudentLessonData> studentLessonDatas,string lessonId)
- {
- int p = 0;
- foreach (var coworkData in coworkDatas)
- {
- var keys = coworkData.participateLevelList.Keys;
- foreach (var key in keys)
- {
- var student = studentLessonDatas.Find(x => x.seatID!.Equals(key));
- if (student!=null && student.attend==1)
- {
- var score = coworkData.participateLevelList[key];//协作得分,是否是经过指数计算的
-
- var itemRecord = new ItemRecord { criterion=-1, itemType= coworkData.coworkType, itemScore=score, isGroup= coworkData.coworkType.Equals("Group") ? true : false };
- //不能完全依赖
- if (score>0)
- {
- student.coworkScore.Add(score);
- itemRecord.resultWeight = InteractWeight.TP;
- itemRecord.resultType = InteractReultType.TP;
- }
- else
- {
- itemRecord.resultWeight = InteractWeight.T0;
- itemRecord.resultType = InteractReultType.T0;
- }
- student.coworkRecord.itemRecords.Add(itemRecord);
- }
- if (key.Contains("g", StringComparison.OrdinalIgnoreCase))
- {
- string groupId = key.Replace("g", "").Replace("G", "");
- var score = coworkData.participateLevelList[key];
- if (score>0)
- {
- var groupStu = studentLessonDatas.FindAll(x => x.attend==1 && !string.IsNullOrWhiteSpace(x.groupId) && x.groupId.Equals(groupId));
- if (groupStu.IsNotEmpty())
- {
- foreach (var stu in groupStu)
- {
- stu.group_coworkScore.Add(score);
- stu.coworkRecord.itemRecords[p].itemScore+=score;
- stu.coworkRecord.itemRecords[p].resultWeight=InteractWeight.TP;
- stu.coworkRecord.itemRecords[p].resultType=InteractReultType.TP;
- }
- }
- }
- }
- }
- 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 max = studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.First().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
- var min = studentLessonDatas.FindAll(x => x.attend==1&& x.coworkRecord.itemRecords[p].itemScore==order.Last().coworkRecord.itemRecords[p].itemScore).First().coworkRecord.itemRecords[p].itemScore;
- var sum = studentLessonDatas.Where(x => x.attend==1).Sum(x => x.coworkRecord.itemRecords[p].itemScore);
- foreach (var student in studentLessonDatas)
- {
- if (student.attend==1 && student.coworkRecord.itemRecords.Count>=p+1 && student.coworkRecord.itemRecords[p].itemScore>0)
- {
- student.coworkRecord.itemRecords[p].resultType=InteractReultType.TP;
- var data = MinMaxNormalization(min, max, student.coworkRecord.itemRecords[p].itemScore);
- student.coworkRecord.itemRecords[p].resultWeight=InteractWeight.T1+ data * 1.0 / 100 * (InteractWeight.TT-InteractWeight.T1);
- if (maxItems.Select(x => x.seatID).Contains(student.seatID))
- {
- student.coworkRecord.itemRecords[p].resultType= InteractReultType.TT;
- student.coworkRecord.itemRecords[p].resultWeight= InteractWeight.TT;
- }
- }
- }
- p++;
- }
- return studentLessonDatas;
- }
- /// <summary>
- /// 处理学生回推数据,并将回推纳入学习态度计算。
- /// </summary>
- /// <param name="lessonBase"></param>
- /// <param name="timeLineData"></param>
- /// <param name="taskDatas"></param>
- /// <param name="studentLessonDatas"></param>
- /// <returns></returns>
- public static List<StudentLessonData> GetTaskData(LessonBase lessonBase, TimeLineData timeLineData, List<TaskData> taskDatas, List<StudentLessonData> studentLessonDatas, string lessonId)
- {
- //协作也算任务的一种,'WrkSpaceLoad' 作品收集, "isGroupItem": false,
- int indexTask = 0;
- foreach (var taskData in taskDatas)
- {
- //作品收集是全部人员都要参加
- foreach (var student in studentLessonDatas)
- {
- if (student.attend==1)
- {
- var work = taskData.clientWorks.Find(x => $"{x.seatID}".Equals(student.seatID));
- if (work!= null)
- {
- if (work.blobFiles.Count>0)
- {
- student.uploadCount.Add(work.blobFiles.Count);
- }
- student.taskRecord.itemRecords.Add(new ItemRecord { itemType="WrkSpaceLoad", itemScore=work.blobFiles.Count *10, resultWeight=InteractWeight.TT, resultType=InteractReultType.TT, isGroup= work.isGroupItem, optCount=work.blobFiles.Count });
- }
- else
- {
- student.taskRecord.itemRecords.Add(new ItemRecord { itemType="WrkSpaceLoad", itemScore=0, resultWeight=InteractWeight.T0, resultType=InteractReultType.T0, isGroup= false });
- }
- }
- }
- ////////
- ///需要处理小组的情况,当前人员没有提交作品,但是有可能是小组其他人员提交了,需要判断一下。
- ///
- var students = studentLessonDatas.FindAll(x => x.attend==1 && x.taskRecord.itemRecords[indexTask].isGroup==true);
- foreach (var student in students)
- {
- var groupStudents = studentLessonDatas.FindAll(x => x.id!=student.id && x.attend==1 && !string.IsNullOrWhiteSpace(x.groupId) && x.groupId.Equals(student.groupId));
- foreach (var groupstudent in groupStudents)
- {
- groupstudent.taskRecord.itemRecords[indexTask].isGroup=true;
- groupstudent.taskRecord.itemRecords[indexTask].optCount=student.taskRecord.itemRecords[indexTask].optCount;
- groupstudent.taskRecord.itemRecords[indexTask].itemScore=student.taskRecord.itemRecords[indexTask].itemScore;
- groupstudent.taskRecord.itemRecords[indexTask].resultWeight=student.taskRecord.itemRecords[indexTask].resultWeight;
- groupstudent.taskRecord.itemRecords[indexTask].resultType=student.taskRecord.itemRecords[indexTask].resultType;
- }
- }
- var groupDatas = taskData.clientWorks.FindAll(x => x.seatID==0 && x.isGroupItem);
- foreach (var groupData in groupDatas)
- {
- var groupStudents = studentLessonDatas.FindAll(x => x.attend==1 && !string.IsNullOrWhiteSpace(x.groupId) && x.groupId.Equals(groupData.groupID));
- foreach (var student in groupStudents)
- {
- student.taskRecord.itemRecords[indexTask].isGroup=true;
- student.taskRecord.itemRecords[indexTask].optCount=groupData.blobFiles.Count;
- student.taskRecord.itemRecords[indexTask].itemScore= 10* groupData.blobFiles.Count;
- if (groupData.blobFiles.Count>0)
- {
- student.taskRecord.itemRecords[indexTask].resultWeight=InteractWeight.TT;
- student.taskRecord.itemRecords[indexTask].resultType=InteractReultType.TT;
- }
- else
- {
- student.taskRecord.itemRecords[indexTask].resultWeight=InteractWeight.T0;
- student.taskRecord.itemRecords[indexTask].resultType=InteractReultType.T0;
- }
- }
- }
- indexTask++;
- }
- return studentLessonDatas;
- }
- /// <summary>
- ///评分参与率 态度计算
- ///读取互评信息
- ///评分相关 在SmartRating.json 处理 GrandRating 星光大评分, 投票Voting 和 PeerAssessment(All每人多件评分,Two随机分配互评, Self自评)
- ///Event 过滤类型 'RatingStart'
- ///smartRateSummary.mutualSummary.mutualType 互评【All(每人多件评分) Two(随机分配互评) Self(自评)】 smartRateSummary.meteor_VoteSummary 投票
- ///读取SmartRating.json
- /// </summary>
- /// <param name="lessonBase"></param>
- /// <param name="timeLineData"></param>
- /// <param name="smartRatingDatas"></param>
- /// <param name="studentLessonDatas"></param>
- /// <returns></returns>
- public static List<StudentLessonData> GetSmartRatingData(LessonBase lessonBase, TimeLineData timeLineData, List<SmartRatingData> smartRatingDatas, List<StudentLessonData> studentLessonDatas,string lessonId)
- {
- int index = 0;
- foreach (var smartRatingData in smartRatingDatas)
- {
- string type = "";
- //投票类型的
- var keys_vote = smartRatingData.smartRateSummary?.meteor_VoteSummary?.Keys?.ToList();
- if (keys_vote.IsNotEmpty())
- {
- type="Voting";
- bool addData = false;
- foreach (var key in keys_vote!)
- {
- try
- {
- //问题数据F:\lesson-local\632424798693232640-local.json pclxxx
- if (smartRatingData.smartRateSummary!.voteDetailResult.TryGetValue(key, out var value))
- {
- var voteDetailResults = smartRatingData.smartRateSummary!.voteDetailResult[key];
- foreach (var student in studentLessonDatas)
- {
- if (student.attend==1)
- {
- //投票是全员参与
- var datasS = voteDetailResults.FindAll(x => x.id.Equals(student.seatID));
- if (datasS.IsNotEmpty())
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T1, resultWeight = InteractWeight.T1 });
- addData=true;
- }
- else
- { //T0 是没有评论别人,也没被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T0, resultWeight = InteractWeight.T0 });
- addData=true;
- }
- //T0 是没有评论别人,也没被别人评论,
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- //TP 有被别人评论,且评论了别人,
- //TT是评论了别人,且被别人评论次数最高,或者分值最高。
- }
- }
- }
- }
- catch (Exception ex)
- {
-
- throw new Exception($"{lessonId}\n{ex.Message}\n{ex.StackTrace}");
- }
- var meteor_VoteSummary = smartRatingData.smartRateSummary!.meteor_VoteSummary[key];
- var order = meteor_VoteSummary.OrderByDescending(x => x.result);
- var maxItems = meteor_VoteSummary.FindAll(x => x.result==order.First().result);
- var max = meteor_VoteSummary.FindAll(x => x.result==order.First().result).First().result;
- var min = meteor_VoteSummary.FindAll(x => x.result==order.Last().result).First().result;
- var sum = meteor_VoteSummary.Sum(x => x.result);
- //排名指数计算=( 当前值分数- 298) / (9992 - 298) * (99 - 60) + 60
- //将每个人的积分转化为60-100
- //排名 = (积分 - 最低积分) / (最高积分 - 最低积分) * (最大排名 - 最小排名) + 最小排名
- foreach (var datasD in meteor_VoteSummary)
- {
- //有被人评论或投票
- var student = studentLessonDatas.Find(x => x.seatID!.Equals(datasD.id));
- if (student!=null)
- {
- if (index<student.rateingRecord.itemRecords.Count && student.rateingRecord.itemRecords[index].itemType!.Equals(type))
- {
- if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T0))
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.T1;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.T1;
- }
- else if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T1))
- {
- //TP 有被别人评论,且评论了别人,
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TP;
- var data = MinMaxNormalization(min, max, datasD.result);
- //student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TP;
- student.rateingRecord.itemRecords[index].resultWeight=InteractWeight.T1+ data * 1.0 / 100 * (InteractWeight.TT-InteractWeight.T1);
- //获得的票数
- student.rateingRecord.itemRecords[index].itemScore=datasD.result;
- //TT是评论了别人,且被别人评论次数最高,或者分值最高。
- if (maxItems.Select(x => x.id).Contains(student.seatID))
- {
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TT;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TT;
- }
- }
- }
- }
- }
- if (addData)
- {
- index++;
- }
- }
- }
- //星光大评分,全员评分
- var keys_GrandRating = smartRatingData.smartRateSummary?.scoreDetailResult?.Keys?.ToList();
- if (keys_GrandRating.IsNotEmpty() && smartRatingData.smartRateSummary!=null && smartRatingData.smartRateSummary.meteor_ScoreSummary.IsNotEmpty())
- {
- bool addData = false;
- type="GrandRating";
- foreach (var student in studentLessonDatas)
- {
- if (student.attend==1)
- {
- if (keys_GrandRating!.Contains(student.seatID!))
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T1, resultWeight = InteractWeight.T1 });
- addData = true;
- }
- else
- {
- //T0 是没有评论别人,也没被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T0, resultWeight = InteractWeight.T0 });
- addData = true;
- }
- }
- }
- var order = smartRatingData.smartRateSummary.meteor_ScoreSummary.Where(x => x.result>0||!string.IsNullOrWhiteSpace(x.comment)).OrderByDescending(x => x.result);
- if (order.Count()>0)
- {
- var maxItems = smartRatingData.smartRateSummary.meteor_ScoreSummary.FindAll(x => x.result==order.First().result);
- var max = smartRatingData.smartRateSummary.meteor_ScoreSummary.FindAll(x => x.result==order.First().result).First().result;
- var min = smartRatingData.smartRateSummary.meteor_ScoreSummary.FindAll(x => x.result==order.Last().result).First().result;
- var sum = smartRatingData.smartRateSummary.meteor_ScoreSummary.Sum(x => x.result);
- foreach (var meteor_ScoreSummary in smartRatingData.smartRateSummary.meteor_ScoreSummary)
- {
- var student = studentLessonDatas.Find(x => x.seatID!.Equals(meteor_ScoreSummary.id));
- if (student!=null)
- {
- if (index<student.rateingRecord.itemRecords.Count && student.rateingRecord.itemRecords[index].itemType!.Equals(type))
- {
- if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T0))
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.T1;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.T1;
- }
- else if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T1))
- {
- //TP 有被别人评论,且评论了别人,
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TP;
- var data = MinMaxNormalization(min, max, meteor_ScoreSummary.result);
- //student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TP;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.T1+ data * 1.0 / 100 * (InteractWeight.TT-InteractWeight.T1);
- //被评论次数
- student.rateingRecord.itemRecords[index].itemScore=meteor_ScoreSummary.result;
- //TT是评论了别人,且被别人评论次数最高,或者分值最高。
- if (maxItems.Select(x => x.id).Contains(student.seatID) &&student.rateingRecord.itemRecords[index].itemScore>0)
- {
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TT;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TT;
- }
- }
- }
- }
- }
- }
- if (addData)
- {
- index++;
- }
- }
- // 互评 PeerAssessment(All每人多件评分,Two随机分配互评, Self自评)
- var keys_PeerAssessment = smartRatingData.smartRateSummary?.mutualDetailSummary?.Keys?.ToList();
- if (keys_PeerAssessment.IsNotEmpty() && smartRatingData.smartRateSummary?.mutualSummary!=null
- && smartRatingData.smartRateSummary.mutualSummary.mutualResults.IsNotEmpty()
- && smartRatingData.smartRateSummary.mutualSummary.materialInfos.IsNotEmpty())
- {
- bool addData = false;
- type="PeerAssessment";
- foreach (var student in studentLessonDatas)
- {
- if (student.attend==1)
- {
- if (keys_PeerAssessment!.Contains(student.seatID!))
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T1, resultWeight = InteractWeight.T1 });
- addData = true;
- }
- else
- {
- //T0 是没有评论别人,也没被别人评论,
- student.rateingRecord.itemRecords.Add(new ItemRecord { itemType=type, resultType=InteractReultType.T0, resultWeight = InteractWeight.T0 });
- addData = true;
- }
- }
- }
- 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 max = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.First().result).First().result;
- var min = smartRatingData.smartRateSummary.mutualSummary.mutualResults.FindAll(x => x.result==order.Last().result).First().result;
- var sum = smartRatingData.smartRateSummary.mutualSummary.mutualResults.Sum(x => x.result);
- foreach (var mutualResult in smartRatingData.smartRateSummary.mutualSummary.mutualResults)
- {
- var student = studentLessonDatas.Find(x => x.seatID!.Equals(mutualResult.id));
- if (student!=null)
- {
- if (index<student.rateingRecord.itemRecords.Count && student.rateingRecord.itemRecords[index].itemType!.Equals(type))
- {
- if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T0))
- {
- //T1,只有评论别人,没被别人评论 或者是评论了别人,但是没有被别人评论,
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.T1;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.T1;
- }
- else if (student.rateingRecord.itemRecords[index].resultType!.Equals(InteractReultType.T1))
- {
- //TP 有被别人评论,且评论了别人,
- //最高分和最低分,票数最多和票数最少的占比来计算TP的占比
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TP;
- var data = MinMaxNormalization(min, max, mutualResult.result);
- //student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TP;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.T1+ data * 1.0 / 100 * (InteractWeight.TT-InteractWeight.T1);
- student.rateingRecord.itemRecords[index].itemScore=mutualResult.result;
- //TT是评论了别人,且被别人评论次数最高,或者分值最高。
- if (maxItems.Select(x => x.id).Contains(student.seatID))
- {
- student.rateingRecord.itemRecords[index].resultType= InteractReultType.TT;
- student.rateingRecord.itemRecords[index].resultWeight= InteractWeight.TT;
- }
- }
- }
- }
- }
- if (addData)
- {
- index++;
- }
- }
- }
- return studentLessonDatas;
- }
- /// <summary>
- /// 最小-最大归一化(Min-Max Normalization)算法。这种算法通常用于将数据的特征值缩放到一个指定的范围内,通常是0到1之间,或者任何其他指定的范围。
- /// </summary>
- /// <returns></returns>
- public static double MinMaxNormalization(double min, double max, double x, double minRank = 1, double maxRank = 100)
- {
- //排名指数计算=( 当前值分数- 298) / (9992 - 298) * (99 - 60) + 60
- //将每个人的积分转化为60-100
- //排名 = (积分 - 最低积分) / (最高积分 - 最低积分) * (最大排名 - 最小排名) + 最小排名
- return x==0 ? 0 : max-min!=0 ? (x - min)*1.0 / (max - min) * (maxRank - minRank) + minRank : (x)*1.0 / (max) * (maxRank - minRank) + minRank;
- }
- public static List<StudentLessonItem> ProcessStudentDataV2(List<StudentLessonData> studentLessonDatas, LessonDataAnalysisCluster lessonDataAnalysis)
-
- {
- //历史记录的个人计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_q = lessonDataAnalysis.pscore.Max();
- //历史记录的互动计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_t = lessonDataAnalysis.tscore.Max();
- //历史记录的小组计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_h = lessonDataAnalysis.gscore.Max();
- var j = InteractWeight.T1;
- double t = InteractWeight.TT;
- List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
- foreach (var studentLessonData in studentLessonDatas)
- {
- StudentLessonItem lessonItem = new StudentLessonItem() { studentId= studentLessonData.id! };
- double u = 0.0;
- if (studentLessonData.attend==1)
- {
- u=100.0;
- }
- //c个人计分指数,d互动计分指数,e小组计分指数
- double c = 0, d = 0, e = 0;
- {
- //互动相关的计分
- //课例互动次数
- double n = studentLessonData.interactRecord.interactRecords.Count()*1.0;
- if (n>0)
- {
- //是IES大陆正式站历史课例数据,自2024-03-01至2024-10-08日,互动指数或学法指数黄灯或绿灯,不包含醍摩豆学校及测试学校,课例时长超过5分钟的有效课例(10,680笔数据) 的IRS互动+抢权+挑人的次数集合,
- //通过“2倍标准差规则” 移除异常值后得到的集合,再通过K-Means聚类算法得到高低位阶互动频次两个集合,并根据当前课例互动次数位阶的集合的质心值,该值定为m值
- var m = n<=lessonDataAnalysis.clustersInteract.First().Value.Max() ? lessonDataAnalysis.clustersInteract.First().Value.Max()*1.0 : lessonDataAnalysis.clustersInteract.Last().Value.Max() *1.0;
- //学生作答次数
- var w = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Count()*1.0;
- //作答正确数(包括部分正确)
- var r = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>InteractWeight.T1).Count()*1.0;
- //有参与的权重集合60≤k(x)≤100
- var kw = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Sum(x => x.resultWeight*1.0);
- //有得分的权重集合60<e(x)≤100
- var er = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>InteractWeight.T1).Sum(x => x.resultWeight*1.0);
- //本节课的所有互动计分
- var i = studentLessonData.interactRecord.interactRecords.Sum(x => x.itemScore*1.0);
- //本节课教师手动给学生的个人计分
- var s = studentLessonData.pscore;
- //个人计分指数
- c = GetPersent(lessonDataAnalysis.pscore, s).persent/100;// s*1.0/max_q;
- //互动计分指数
- d = GetPersent(lessonDataAnalysis.tscore, i).persent/100; //i*1.0/max_t;
- //互动成效指数
- var a = (d+w*kw/(j*m)+r*er/(j*m))*1.0/n;
- //互动参与指数
- var b = ((w*w)/m+(r*r)/m)*1.0/n;
- //c+a= 个人计分指数+ 个人互动成效指数
- //学习成效
- var f1 = Math.Round(190*1.0/(1+Math.Exp(-(c+a)))-95, 4);
- lessonItem.hd_cx=f1;
- var f2 = Math.Round(200*1.0/(1+Math.Exp(-(b+u/100)))-100, 4);
- lessonItem.hd_cy=f2;
- lessonItem.hd_cyc=w;
- lessonItem.hd_fqc=n;
- lessonItem.hd_zqc=r;
- lessonItem.gr_jf=s;
- }
- //studentLessonData.achieve=f1;
- //studentLessonData.attitude=f2;
- // _logger.LogInformation($"{studentLessonData.id}=>学习成效:{f1}\t学习态度:{f2}\t互动次数:{n}\t参与次数:{w}\t正确次数:{r}\t个人计分:{s}\t{Math.Round(c, 2)}\t互动计分:{i}\t{Math.Round(d, 2)}");
- }
- {
- //评测相关指数
- double n = studentLessonData.examRecords.Count()*1.0;
- if (n>0)
- {
- //题目数量
- double nq = studentLessonData.examRecords.Sum(x => x.qcount)*1.0;
- // double max_e = lessonDataAnalysis.exam.Max();
- //得分率
- double sum_s = studentLessonData.examRecords.Sum(x => x.scoreRate);
- //作答率
- double sum_a = studentLessonData.examRecords.Sum(x => x.answerRate);
- double f8 = Math.Round(sum_s/n*100, 4);
- double f9 = Math.Round(sum_a/n*100, 4);
- lessonItem.pc_df=f8;
- lessonItem.pc_zd=f9;
- }
- // _logger.LogInformation($"{studentLessonData.id}=>评测指数:{f8}\t得分率:{Math.Round(sum_s/n,4)}\t参与指数:{f9}\t作答率:{Math.Round(sum_a/n,4)}");
- }
- {
- //小组相关指数
- }
- {
- //任务相关指数
- double n = studentLessonData.taskRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- double max_m = lessonDataAnalysis.task.Max();
- double w = studentLessonData.taskRecord.itemRecords.Where(x => x.resultWeight>0).Count()*1.0;
- double y = (10 *w/n+(j/t) *w)/max_m;
- double l = max_m*(w*w/n+(j/t) * w)/n;
- double f4 = Math.Round(190*1.0/(1+Math.Exp(-(y)))-95, 4);
- double f5 = Math.Round(200*1.0/(1+Math.Exp(-(l)))-100, 4);
- lessonItem.rw_fqc =n;
- lessonItem.rw_cyc =w;
- lessonItem.rw_cx =f4;
- lessonItem.rw_cy =f5;
- }
- // _logger.LogInformation($"{studentLessonData.id}=>任务指数:{f4}\t参与指数:{f5}\t任务次数:{n}\t参与次数:{w}\t");
- }
- {
- //评价相关指数
- double n = studentLessonData.rateingRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- var v = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("Voting"));
- double vc = v.Count()*1.0;
- var g = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("GrandRating"));
- double gc = g.Count()*1.0;
- var p = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("PeerAssessment"));
- double pc = p.Count()*1.0;
- var vg = v.Sum(x => x.itemScore);
- var vo = v.Sum(x => x.optCount);
- double vs = vc/n* (vg+ vo);
- var gg = g.Sum(x => x.itemScore);
- var go = g.Sum(x => x.optCount);
- double gs = gc/n* (gg+ go);
- var pg = p.Sum(x => x.itemScore);
- var po = p.Sum(x => x.optCount);
- double ps = pc/n* (pg+ po);
- double h = vs+ps+gs;
- double f3 = Math.Round(190*1.0/(1+Math.Exp(-(h)))-95, 4);
- studentLessonData.appraise=f3;
- // _logger.LogInformation($"{studentLessonData.id}=>评价能力:{f3}\t评价次数:{n}\t投票次数:{vc}-{vg}-{vo}\t星光次数:{gc}-{gg}-{go}\t互评次数:{pc}-{pg}-{po}");
- lessonItem.pj_nl =f3;
- lessonItem.pj_cs =n;
- lessonItem.pj_vc =vc;
- lessonItem.pj_vg =vg;
- lessonItem.pj_vo =vo;
- lessonItem.pj_gc =gc;
- lessonItem.pj_gg =gg;
- lessonItem.pj_go =go;
- lessonItem.pj_pc =pc;
- lessonItem.pj_pg =pg;
- lessonItem.pj_po =po;
- }
- }
- {
- //协作相关指数
- var n = studentLessonData.coworkRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- //总的协作成果数
- var w = studentLessonData.coworkRecord.itemRecords.Where(x => x.resultWeight>0);
- double ss = w.Sum(x => x.itemScore)*1.0;
- double sw = w.Sum(x => x.resultWeight)*1.0;
- double wc = w.Count()*1.0;
- double x = 0.0;
- if (wc>0)
- {
- x=sw/(j *wc);
- }
- double max_xzcg = 40;
- double k = (wc*wc/n+x)/n+ wc*(ss/max_xzcg)* (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);
- lessonItem.xz_fqc =n;
- lessonItem.xz_cyc =wc;
- lessonItem.xz_cgf =ss;
- lessonItem.xz_cx =f6;
- lessonItem.xz_cy =f7;
- }
- //_logger.LogInformation($"{studentLessonData.id}=>协作指数:{f6}\t参与指数:{f7}\t协作次数:{n}\t参与次数:{wc}\t协作成果分数:{ss}\t{k}");
- }
- double xx_cx = 0, xx_cy = 0;
- int avg_cx = 0, avg_cy = 0;
- if (lessonItem.xz_cx>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.pj_nl>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.rw_cx>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.pc_df>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.hd_cx>0)
- {
- avg_cx+=1;
- }
- xx_cx+=lessonItem.hd_cx * 1.0/avg_cx+ lessonItem.pc_df* 1.0/avg_cx+ lessonItem.rw_cx* 1.0/avg_cx+ lessonItem.pj_nl* 1.0/avg_cx+ lessonItem.xz_cx* 1.0/avg_cx;
- if (lessonItem.xz_cy>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.pj_nl>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.rw_cy>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.pc_zd>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.hd_cy>0)
- {
- avg_cy+=1;
- }
- xx_cy+=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.xx_cx=xx_cx;
- lessonItem.xx_cy=xx_cy;
- lessonItems.Add(lessonItem);
- }
- return lessonItems;
- }
- /// <summary>
- /// 计算学生的学习成效,学习态度,合作能力,协作能力,评价能力
- /// </summary>
- /// <param name="studentLessonDatas"></param>
- /// <param name="lessonDataAnalysis"></param>
- /// <returns></returns>
- public static List<StudentLessonItem> ProcessStudentDataV1(List<StudentLessonData> studentLessonDatas, LessonDataAnalysisCluster lessonDataAnalysis)
- {
- //历史记录的个人计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_q = lessonDataAnalysis.pscore.Max();
- //历史记录的互动计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_t = lessonDataAnalysis.tscore.Max();
- //历史记录的小组计分集合,通过“2倍标准差规则”移除异常值后得到的集合
- var max_h = lessonDataAnalysis.gscore.Max();
- var j = InteractWeight.T1;
- double t = InteractWeight.TT;
- List<StudentLessonItem> lessonItems = new List<StudentLessonItem>();
- foreach (var studentLessonData in studentLessonDatas)
- {
- StudentLessonItem lessonItem = new StudentLessonItem() { studentId= studentLessonData.id! };
- double u = 0.0;
- if (studentLessonData.attend==1)
- {
- u=100.0;
- }
- //c个人计分指数,d互动计分指数,e小组计分指数
- double c = 0, d = 0, e = 0;
- {
- //互动相关的计分
- //课例互动次数
- double n = studentLessonData.interactRecord.interactRecords.Count()*1.0;
- if (n>0)
- {
- //是IES大陆正式站历史课例数据,自2024-03-01至2024-10-08日,互动指数或学法指数黄灯或绿灯,不包含醍摩豆学校及测试学校,课例时长超过5分钟的有效课例(10,680笔数据) 的IRS互动+抢权+挑人的次数集合,
- //通过“2倍标准差规则” 移除异常值后得到的集合,再通过K-Means聚类算法得到高低位阶互动频次两个集合,并根据当前课例互动次数位阶的集合的质心值,该值定为m值
- var m = n<=lessonDataAnalysis.clustersInteract.First().Value.Max() ? lessonDataAnalysis.clustersInteract.First().Key*1.0 : lessonDataAnalysis.clustersInteract.Last().Key *1.0;
- //学生作答次数
- var w = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Count()*1.0;
- //作答正确数(包括部分正确)
- var r = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>InteractWeight.T1).Count()*1.0;
- //有参与的权重集合60≤k(x)≤100
- var kw = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>=InteractWeight.T1).Sum(x => x.resultWeight*1.0);
- //有得分的权重集合60<e(x)≤100
- var er = studentLessonData.interactRecord.interactRecords.Where(x => x.resultWeight>InteractWeight.T1).Sum(x => x.resultWeight*1.0);
- //本节课的所有互动计分
- var i = studentLessonData.interactRecord.interactRecords.Sum(x => x.itemScore*1.0);
- //本节课教师手动给学生的个人计分
- var s = studentLessonData.pscore;
- //个人计分指数
- c = GetPersent(lessonDataAnalysis.pscore, s).persent/100;// s*1.0/max_q;
- //互动计分指数
- d = GetPersent(lessonDataAnalysis.tscore, i).persent/100; //i*1.0/max_t;
- //互动成效指数
- var a = (d+w*kw/(j*m)+r*er/(j*m))*1.0/n;
- //互动参与指数
- var b = ((w*w)/m+(r*r)/m)*1.0/n;
- //c+a= 个人计分指数+ 个人互动成效指数
- //学习成效
- var f1 = Math.Round(190*1.0/(1+Math.Exp(-(c+a)))-95, 4);
- lessonItem.hd_cx=f1;
- var f2 = Math.Round(200*1.0/(1+Math.Exp(-(b+u/100)))-100, 4);
- lessonItem.hd_cy=f2;
- lessonItem.hd_cyc=w;
- lessonItem.hd_fqc=n;
- lessonItem.hd_zqc=r;
- lessonItem.gr_jf=s;
- }
- //studentLessonData.achieve=f1;
- //studentLessonData.attitude=f2;
- // _logger.LogInformation($"{studentLessonData.id}=>学习成效:{f1}\t学习态度:{f2}\t互动次数:{n}\t参与次数:{w}\t正确次数:{r}\t个人计分:{s}\t{Math.Round(c, 2)}\t互动计分:{i}\t{Math.Round(d, 2)}");
- }
- {
- //评测相关指数
- double n = studentLessonData.examRecords.Count()*1.0;
- if (n>0)
- {
- //题目数量
- double nq = studentLessonData.examRecords.Sum(x => x.qcount)*1.0;
- // double max_e = lessonDataAnalysis.exam.Max();
- //得分率
- double sum_s = studentLessonData.examRecords.Sum(x => x.scoreRate);
- //作答率
- double sum_a = studentLessonData.examRecords.Sum(x => x.answerRate);
- double f8 = Math.Round(sum_s/n*100, 4);
- double f9 = Math.Round(sum_a/n*100, 4);
- lessonItem.pc_df=f8;
- lessonItem.pc_zd=f9;
- }
- // _logger.LogInformation($"{studentLessonData.id}=>评测指数:{f8}\t得分率:{Math.Round(sum_s/n,4)}\t参与指数:{f9}\t作答率:{Math.Round(sum_a/n,4)}");
- }
- {
- //小组相关指数
- }
- {
- //任务相关指数
- double n = studentLessonData.taskRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- double max_m = lessonDataAnalysis.task.Max();
- double w = studentLessonData.taskRecord.itemRecords.Where(x => x.resultWeight>0).Count()*1.0;
- double y = (10 *w/n+(j/t) *w)/max_m;
- double l = max_m*(w*w/n+(j/t) * w)/n;
- double f4 = Math.Round(190*1.0/(1+Math.Exp(-(y)))-95, 4);
- double f5 = Math.Round(200*1.0/(1+Math.Exp(-(l)))-100, 4);
- lessonItem.rw_fqc =n;
- lessonItem.rw_cyc =w;
- lessonItem.rw_cx =f4;
- lessonItem.rw_cy =f5;
- }
- // _logger.LogInformation($"{studentLessonData.id}=>任务指数:{f4}\t参与指数:{f5}\t任务次数:{n}\t参与次数:{w}\t");
- }
- {
- //评价相关指数
- double n = studentLessonData.rateingRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- var v = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("Voting"));
- double vc = v.Count()*1.0;
- var g = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("GrandRating"));
- double gc = g.Count()*1.0;
- var p = studentLessonData.rateingRecord.itemRecords.Where(x => x.itemType.Equals("PeerAssessment"));
- double pc = p.Count()*1.0;
- var vg = v.Sum(x => x.itemScore);
- var vo = v.Sum(x => x.optCount);
- double vs = vc/n* (vg+ vo);
- var gg = g.Sum(x => x.itemScore);
- var go = g.Sum(x => x.optCount);
- double gs = gc/n* (gg+ go);
- var pg = p.Sum(x => x.itemScore);
- var po = p.Sum(x => x.optCount);
- double ps = pc/n* (pg+ po);
- double h = vs+ps+gs;
- double f3 = Math.Round(190*1.0/(1+Math.Exp(-(h)))-95, 4);
- studentLessonData.appraise=f3;
- // _logger.LogInformation($"{studentLessonData.id}=>评价能力:{f3}\t评价次数:{n}\t投票次数:{vc}-{vg}-{vo}\t星光次数:{gc}-{gg}-{go}\t互评次数:{pc}-{pg}-{po}");
- lessonItem.pj_nl =f3;
- lessonItem.pj_cs =n;
- lessonItem.pj_vc =vc;
- lessonItem.pj_vg =vg;
- lessonItem.pj_vo =vo;
- lessonItem.pj_gc =gc;
- lessonItem.pj_gg =gg;
- lessonItem.pj_go =go;
- lessonItem.pj_pc =pc;
- lessonItem.pj_pg =pg;
- lessonItem.pj_po =po;
- }
- }
- {
- //协作相关指数
- var n = studentLessonData.coworkRecord.itemRecords.Count()*1.0;
- if (n>0)
- {
- //总的协作成果数
- var w = studentLessonData.coworkRecord.itemRecords.Where(x => x.resultWeight>0);
- double ss = w.Sum(x => x.itemScore)*1.0;
- double sw = w.Sum(x => x.resultWeight)*1.0;
- double wc = w.Count()*1.0;
- double x = 0.0;
- if (wc>0)
- {
- x=sw/(j *wc);
- }
- double max_xzcg = 40;
- double k = (wc*wc/n+x)/n+ wc*(ss/max_xzcg)* (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);
- lessonItem.xz_fqc =n;
- lessonItem.xz_cyc =wc;
- lessonItem.xz_cgf =ss;
- lessonItem.xz_cx =f6;
- lessonItem.xz_cy =f7;
- }
- //_logger.LogInformation($"{studentLessonData.id}=>协作指数:{f6}\t参与指数:{f7}\t协作次数:{n}\t参与次数:{wc}\t协作成果分数:{ss}\t{k}");
- }
- double xx_cx = 0, xx_cy = 0;
- int avg_cx = 0, avg_cy = 0;
- if (lessonItem.xz_cx>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.pj_nl>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.rw_cx>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.pc_df>0)
- {
- avg_cx+=1;
- }
- if (lessonItem.hd_cx>0)
- {
- avg_cx+=1;
- }
- xx_cx+=lessonItem.hd_cx * 1.0/avg_cx+ lessonItem.pc_df* 1.0/avg_cx+ lessonItem.rw_cx* 1.0/avg_cx+ lessonItem.pj_nl* 1.0/avg_cx+ lessonItem.xz_cx* 1.0/avg_cx;
- if (lessonItem.xz_cy>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.pj_nl>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.rw_cy>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.pc_zd>0)
- {
- avg_cy+=1;
- }
- if (lessonItem.hd_cy>0)
- {
- avg_cy+=1;
- }
- xx_cy+=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.xx_cx=xx_cx;
- lessonItem.xx_cy=xx_cy;
- lessonItems.Add(lessonItem);
- }
- return lessonItems;
- }
- /// <summary>
- /// 使用标准差定义异常值。如果一个数字与平均值的偏差超过某个标准差倍数(例如2倍或3倍),则可以认为它是异常的。
- /// </summary>
- /// <param name="array"></param>
- /// <returns></returns>
- public static List<double> CleanDataBySDThreshold(IEnumerable<double> array, double thresholdMultiplier = 2)
- {
- if (array.Count() == 0) return new List<double>();
- double average = Math.Round(array.Sum()*1.0/array.Count(), 4);
- double variance = array.Select(x => Math.Round(Math.Pow(x - average, 2), 4)).Sum()*1.0/array.Count();
- double standardDeviation = Math.Sqrt(Math.Round(variance, 4));
- double threshold = Math.Round(thresholdMultiplier * standardDeviation);
- List<double> datas = new List<double>();
- foreach (double value in array)
- {
- double deviation = Math.Round(Math.Abs(value - average), 4);
- if (deviation <= threshold)
- {
- datas.Add(value);
- }
- }
- return datas;
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <param name="items"></param>
- /// <param name="filePath"></param>
- /// <returns></returns>
- public static async Task ExportToExcel(List<StudentLessonItem> items, string filePath, XmlDocument xmlDocument)
- {
- ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
- using (ExcelPackage package = new ExcelPackage())
- {
- ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("学生课中数据");
- // 获取类的属性
- PropertyInfo[] properties = typeof(StudentLessonItem).GetProperties();
- // 添加表头
- int currentRow = 1;
- for (int i = 0; i < properties.Length; i++)
- {
- string summary = Regex.Replace(GetPropertySummary(properties[i], xmlDocument), @"\s+", "");
- worksheet.Cells[currentRow, i + 1].Value = summary;
- }
- // 填充数据
- currentRow = 2;
- foreach (var item in items)
- {
- for (int i = 0; i < properties.Length; i++)
- {
- worksheet.Cells[currentRow, i + 1].Value = properties[i].GetValue(item);
- }
- currentRow++;
- }
- // 设置表格样式
- worksheet.Cells[worksheet.Dimension.Address].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
- worksheet.Cells[worksheet.Dimension.Address].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
- // 保存到文件
- FileInfo fileInfo = new System.IO.FileInfo(filePath);
- await package.SaveAsAsync(fileInfo);
- }
- }
- private static string GetPropertySummary(PropertyInfo property,XmlDocument xmlDocument)
- {
- XmlNodeList? xmlNodeList = xmlDocument.DocumentElement?.SelectNodes("//member[@name='P:" + property.DeclaringType?.FullName + "." + property.Name + "']");
- if (xmlNodeList!= null && xmlNodeList.Count > 0)
- {
- XmlNode? xmlNode = xmlNodeList[0];
- if (xmlNode != null && xmlNode.FirstChild != null)
- {
- return xmlNode.FirstChild.InnerText;
- }
- }
- return property.Name;
- }
- /// <summary>
- /// 当前数超越集合的百分比
- /// </summary>
- /// <param name="nums"></param>
- /// <param name="curr"></param>
- /// <returns></returns>
- public static (double persent,int count ) GetPersent(IEnumerable<double> nums, double curr)
- {
- int count = 0;
- foreach (var op in nums.OrderBy(x => x))
- {
- if (op < curr)
- {
- count++;
- }
- else if (op == curr)
- {
- count++;
- }
- else
- {
- break;
- }
- }
- return (count *1.0/ nums.Count() * 100,count);
- }
- }
- /// <summary>
- /// 学生导出Excel的Entity
- /// </summary>
- public class StudentLessonItem
- {
- /// <summary>
- /// 学生id
- /// </summary>
- public string? studentId { get; set; }
- /// <summary>
- /// 互动发起次数
- /// </summary>
- public double hd_fqc { get; set; } = 0;
- /// <summary>
- /// 互动参与次数
- /// </summary>
- public double hd_cyc { get; set; } = 0;
- /// <summary>
- /// 互动正确次数
- /// </summary>
- public double hd_zqc { get; set; } = 0;
- /// <summary>
- /// 个人计分
- /// </summary>
- public double gr_jf { get; set; } = 0;
- /// <summary>
- /// 互动成效指数
- /// </summary>
- public double hd_cx { get; set; } = 0;
- /// <summary>
- /// 互动参与指数
- /// </summary>
- public double hd_cy { get; set; } = 0;
- /// <summary>
- /// 评测得分率
- /// </summary>
- public double pc_df { get; set; } = 0;
- /// <summary>
- /// 评测作答率
- /// </summary>
- public double pc_zd { get; set; } = 0;
- /// <summary>
- /// 任务发起次数
- /// </summary>
- public double rw_fqc { get; set; } = 0;
- /// <summary>
- /// 任务参与次数
- /// </summary>
- public double rw_cyc { get; set; } = 0;
- /// <summary>
- /// 任务成效指数
- /// </summary>
- public double rw_cx { get; set; } = 0;
- /// <summary>
- /// 任务参与指数
- /// </summary>
- public double rw_cy { get; set; } = 0;
- /// <summary>
- /// 评价发起次数
- /// </summary>
- public double pj_cs { get; set; } = 0;
- /// <summary>
- /// 投票发起次数
- /// </summary>
- public double pj_vc { get; set; } = 0;
- /// <summary>
- /// 投票得票数
- /// </summary>
- public double pj_vg { get; set; } = 0;
- /// <summary>
- /// 投票次数
- /// </summary>
- public double pj_vo { get; set; } = 0;
- /// <summary>
- /// 星光发起次数
- /// </summary>
- public double pj_gc { get; set; } = 0;
- /// <summary>
- /// 星光得分数
- /// </summary>
- public double pj_gg { get; set; } = 0;
- /// <summary>
- /// 星光评分次数
- /// </summary>
- public double pj_go { get; set; } = 0;
- /// <summary>
- /// 互评发起次数
- /// </summary>
- public double pj_pc { get; set; } = 0;
- /// <summary>
- /// 互评得分数
- /// </summary>
- public double pj_pg { get; set; } = 0;
- /// <summary>
- /// 互评评分次数
- /// </summary>
- public double pj_po { get; set; } = 0;
- /// <summary>
- /// 评价能力
- /// </summary>
- public double pj_nl { get; set; } = 0;
- /// <summary>
- /// 协作发起次数
- /// </summary>
- public double xz_fqc { get; set; } = 0;
- /// <summary>
- /// 协作参与次数
- /// </summary>
- public double xz_cyc { get; set; } = 0;
- /// <summary>
- /// 协作成果分数
- /// </summary>
- public double xz_cgf { get; set; } = 0;
- /// <summary>
- /// 协作能力指数
- /// </summary>
- public double xz_cx { get; set; } = 0;
- /// <summary>
- /// 协作参与指数
- /// </summary>
- public double xz_cy { get; set; } = 0;
- /// <summary>
- /// 学习成效
- /// </summary>
- public double xx_cx { get; set; } = 0;
- /// <summary>
- /// 学习参与
- /// </summary>
- public double xx_cy { get; set; } = 0;
- }
- /// <summary>
- /// 历史课例的关键数据模型
- /// </summary>
- public class LessonDataAnalysisCluster: LessonDataAnalysisBase
- {
-
- /// <summary>
- ///
- /// </summary>
- public List<KeyValuePair<double, List<double>>> clustersInteract { get; set; } = new List<KeyValuePair<double, List<double>>>();
- ///// <summary>
- /////
- ///// </summary>
- //public List<KeyValuePair<double, List<double>>> clustersPscore { get; set; } = new List<KeyValuePair<double, List<double>>>();
- ///// <summary>
- /////
- ///// </summary>
- //public List<KeyValuePair<double, List<double>>> clustersTscore { get; set; } = new List<KeyValuePair<double, List<double>>>();
- ///// <summary>
- /////
- ///// </summary>
- //public List<KeyValuePair<double, List<double>>> clustersGscore { get; set; } = new List<KeyValuePair<double, List<double>>>();
-
-
- }
- /// <summary>
- ///
- /// </summary>
- public abstract class LessonDataAnalysisBase
- {
- ///// <summary>
- ///// 协作次数
- ///// </summary>
- //public IEnumerable<double> cowork { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> coworkBase { get; set; } = new List<double>();
- /// <summary>
- ///
- /// </summary>
- public List<double> task { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> taskBase { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> exam { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> examBase { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> smartRating { get; set; } = new List<double>();
- ///// <summary>
- /////
- ///// </summary>
- //public IEnumerable<double> smartRatingBase { get; set; } = new List<double>();
- /// <summary>
- ///
- /// </summary>
- public List<double> irs { get; set; } = new List<double>();
- /// <summary>
- ///
- /// </summary>
- public List<double> interactNormal { get; set; } = new List<double>();
- /// <summary>
- /// 个人计分
- /// </summary>
- public List<double> pscore { get; set; } = new List<double>();
- /// <summary>
- /// 小组计分
- /// </summary>
- public List<double> gscore { get; set; } = new List<double>();
- /// <summary>
- /// 互动计分
- /// </summary>
- public List<double> tscore { get; set; } = new List<double>();
- /// <summary>
- /// 作品上传数
- /// </summary>
- public List<List<double>> upload { get; set; } = new List<List<double>>();
- /// <summary>
- /// 学生协作成果数
- /// </summary>
- public List<double> stuCowork { get; set; } = new List<double>();
- /// <summary>
- /// 小组协作成果数
- /// </summary>
- public List<double> groupCowork { get; set; } = new List<double>();
- ///// <summary>
- ///// 挑人集合
- ///// </summary>
- //public List<List<string>> pickup { get; set; } = new List<List<string>>();
- ///// <summary>
- ///// 挑人集合-小组
- ///// </summary>
- //public List<List<string>> pickup_group { get; set; } = new List<List<string>>();
- }
- /// <summary>
- /// 每月的课例模型数据
- /// </summary>
- public class LessonDataAnalysisMonth: LessonDataAnalysisBase
- {
- /// <summary>
- /// 时间戳
- /// </summary>
- public long updateTime { get; set; }
- /// <summary>
- /// yyyyMM
- /// </summary>
- public string? yearMonth { get; set; }
-
- }
- /// <summary>
- ///
- /// </summary>
- public class LessonLocal
- {
- /// <summary>
- ///
- /// </summary>
- public LessonBase? lessonBase { get; set; }
- /// <summary>
- ///
- /// </summary>
- public TimeLineData? timeLineData { get; set; }
- /// <summary>
- ///
- /// </summary>
- public LessonRecord? lessonRecord { get; set; }
- /// <summary>
- ///
- /// </summary>
- public List<LocalStudent> studentLessonDatas { get; set; } = new List<LocalStudent>();
- /// <summary>
- ///
- /// </summary>
- public List<TaskData> taskDatas { get; set; } = new List<TaskData>();
- /// <summary>
- ///
- /// </summary>
- public List<SmartRatingData> smartRatingDatas { get; set; } = new List<SmartRatingData>();
- /// <summary>
- ///
- /// </summary>
- public List<IRSData> irsDatas { get; set; } = new List<IRSData>();
- /// <summary>
- ///
- /// </summary>
- public List<CoworkData> coworkDatas { get; set; } = new List<CoworkData>();
- /// <summary>
- ///
- /// </summary>
- public List<ExamData> examDatas { get; set; } = new List<ExamData>();
- /// <summary>
- ///
- /// </summary>
- public List<TimeLineEvent> sokratesDatas { get; set; } = new List<TimeLineEvent>();
- }
- /// <summary>
- ///
- /// </summary>
- public class TechCount
- {
- public string? yearMonth { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string? lessonId { get; set; }
- /// <summary>
- /// 评测数量
- /// </summary>
- public int examCount { get; set; }
- /// <summary>
- /// 任务数量
- /// </summary>
- public int taskCount { get; set; }
- /// <summary>
- /// IRS次数
- /// </summary>
- public int irsCount { get; set; }
- /// <summary>
- /// 互动次数
- /// </summary>
- //public int interactExamCount { get; set; }
- /// <summary>
- /// 互动次数
- /// </summary>
- public int interactNormalCount { get; set; }
- /// <summary>
- /// 协作次数
- /// </summary>
- public int coworkCount { get; set; }
- /// <summary>
- /// 智能评分次数
- /// </summary>
- public int smartRatingCount { get; set; }
- /// <summary>
- ///
- /// </summary>
- public List<CodeLong> timeCount { get; set; } = new List<CodeLong>();
- /// <summary>
- ///
- /// </summary>
- public IEnumerable<double> pscore { get; set; } = new List<double>();
- /// <summary>
- ///
- /// </summary>
- public IEnumerable<double> gscore { get; set; } = new List<double>();
- /// <summary>
- ///
- /// </summary>
- public IEnumerable<double> tscore { get; set; } = new List<double>();
- /// <summary>
- /// 评测数量
- /// </summary>
- public int examCountBase { get; set; }
- /// <summary>
- /// 任务数量
- /// </summary>
- public int taskCountBase { get; set; }
- /// <summary>
- /// IRS次数
- /// </summary>
- public int irsCountBase { get; set; }
- /// <summary>
- /// 互动次数
- /// </summary>
- //public int interactExamCountBase { get; set; }
- /// <summary>
- /// 互动次数
- /// </summary>
- public int interactNormalCountBase { get; set; }
- /// <summary>
- /// 协作次数
- /// </summary>
- public int coworkCountBase { get; set; }
- /// <summary>
- /// 智能评分次数
- /// </summary>
- public int smartRatingCountBase { get; set; }
- /// <summary>
- /// 作品上传数
- /// </summary>
- public List<List<double>> upload { get; set; } = new List<List<double>>();
- /// <summary>
- /// 学生协作成果数
- /// </summary>
- public List<double> stuCowork { get; set; } = new List<double>();
- /// <summary>
- /// 小组协作成果数
- /// </summary>
- public List<double> groupCowork { get; set; } = new List<double>();
- }
- }
|