/// <summary> /// This a general function that implements the calculation of (CalcNumberOfItemsFromRightToWrong, CalcNumberOfItemsFromWrongToRight, CalcNumberOfItemsFromWrongToWrong) methods /// </summary> /// <param name="snapshotTable"></param> /// <param name="condition"></param> /// <returns></returns> public int GeneralFunc2(List <Snapshot> snapshotTable, PassConditionForChangingAnswers condition) { var snapshotByItemNum = snapshotTable.GroupBy(x => x.ItemNum); int numberOfAttempts = 0; foreach (var snapsForEachItem in snapshotByItemNum) { var lastAnswer = snapsForEachItem.LastOrDefault().Response; var correctAnswer = "Choice(s): " + correctAnswerList[snapsForEachItem.Key]; if (condition(snapsForEachItem, correctAnswer, lastAnswer)) { numberOfAttempts++; } } return(numberOfAttempts); }
public void CalcNumberOfItemsFromWrongToWrongFirstAndLast(List <Snapshot> snapshotTable) { PassConditionForChangingAnswers ConditionForAnswersWrongToWrongFirstAndLast = GetConditionForAnswersWrongToWrongFirsAndtLast; this.NumberOfItemsAnswerWasFromWrongToWrongFirstAndLast = GeneralFunc2(snapshotTable, ConditionForAnswersWrongToWrongFirstAndLast); }
/// <summary> /// This function checks the first and final answer of a question; if they are both correct, it checks the other visits' answers, and if it finds a wrong answer amongst the previous visits, it consders the answer "from right to wrong to right". /// </summary> /// <param name="snapshotTable"></param> public void CalcNumberOfItemsFromRightToWrongToRight(List <Snapshot> snapshotTable) { PassConditionForChangingAnswers ConditionForAnswersWrongToRight = GetConditionForAnswersRightToWrongToRight; this.NumberOfItemsFromRightToWrongToRight = GeneralFunc2(snapshotTable, ConditionForAnswersWrongToRight);; }