Zufallsauswahl von Fragen verbessert;
This commit is contained in:
1 parent
5d31cc2d3c
commit
11debb4c96
1 file changed
+1
-3
@@ -64,11 +64,9 @@ namespace MultipleChoiceTrainer.Controllers
|
|||||||
questions = questions.OrderByDescending(e => e.Answers.Where(a => a.Date > newestDate).Count());
|
questions = questions.OrderByDescending(e => e.Answers.Where(a => a.Date > newestDate).Count());
|
||||||
var minAnswerCount = questions.Select(e => e.Answers.Where(a => a.Date > newestDate).Count()).Min();
|
var minAnswerCount = questions.Select(e => e.Answers.Where(a => a.Date > newestDate).Count()).Min();
|
||||||
questions = questions.Where(e => e.Answers.Where(a => a.Date > newestDate).Count() == minAnswerCount);
|
questions = questions.Where(e => e.Answers.Where(a => a.Date > newestDate).Count() == minAnswerCount);
|
||||||
questions = questions.Take(10);
|
//questions = questions.Take(10);
|
||||||
|
|
||||||
|
|
||||||
vm.CurrentQuestion = questions.ElementAt(_rnd.Next(0, questions.Count()-1));
|
vm.CurrentQuestion = questions.ElementAt(_rnd.Next(0, questions.Count()-1));
|
||||||
|
|
||||||
vm.Choices = vm.CurrentQuestion.Choices.Select(oc => new Choice() { Id = oc.Id, Text = oc.Text }).OrderBy(a => Guid.NewGuid()).ToList();
|
vm.Choices = vm.CurrentQuestion.Choices.Select(oc => new Choice() { Id = oc.Id, Text = oc.Text }).OrderBy(a => Guid.NewGuid()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user