This commit is contained in:
Neha Ranade 2022-03-10 00:48:07 +00:00
Родитель 081180046d
Коммит f2200cc79c
1 изменённых файлов: 0 добавлений и 8 удалений

Просмотреть файл

@ -178,14 +178,12 @@ namespace Assessment.App.Functions.Student
{
if (requestData.Responses.TryGetValue(questionId, out var responseInfo))
{
questionItems[questionId].Answer.ForEach(Console.WriteLine);
var questionType = questionItems[questionId].QuestionType;
var studentAns = responseInfo.ChosenOption;
studentAns = studentAns.Select(s => s.ToLowerInvariant()).ToArray();
var correctAns = questionItems[questionId].Answer;
correctAns = correctAns.ConvertAll(d => d.ToLower());
var res = getResult(studentAns, correctAns.ToArray(), questionType);
Console.WriteLine(res.ToString());
correctAnswers = correctAnswers + res;
}
}
@ -234,13 +232,8 @@ namespace Assessment.App.Functions.Student
private static int getResult(string[] studentResponse, string[] correctAns, string questionType){
if (questionType == "MCQ" || questionType == "TF"){
Console.WriteLine("Yep this is either TF or MCQ");
Array.Sort(studentResponse);
Console.WriteLine("This is student response after sorting");
Console.WriteLine(String.Join("\n", studentResponse));
Array.Sort(correctAns);
Console.WriteLine("This is OG response after sorting");
Console.WriteLine(String.Join("\n", correctAns));
if (studentResponse.SequenceEqual(correctAns)){
return 1;
}
@ -251,7 +244,6 @@ namespace Assessment.App.Functions.Student
if (questionType == "QA"){
foreach(string answer in studentResponse ){
if (correctAns.Contains(answer)){
// currently case insensitive
return 1;
}
}