public void FillSolvedTests()
 {
     SolvedTests.Clear();
     foreach (var history in _dao.GetAllHistories())
     {
         if (history.User.Name == UserName || _dao.IsEditor(UserName) == true)
         {
             //gonna do a function from that
             List <List <int> > checkedAnswers = _dao.SelectCheckedAnswers(history.Id);
             history.ChosenAnswers = new List <IAnsweredQuestion>();
             int count = history.Question.Count;
             for (int i = 0; i < count; i++)
             {
                 if (checkedAnswers.Count > i)
                 {
                     if (history.ChosenAnswers.Count <= i)
                     {
                         history.ChosenAnswers.Add(_dao.CreateNewAnsweredQuestion());
                     }
                     history.ChosenAnswers[i].ChosenAnswers = checkedAnswers[i];
                     //adding list of integers (answer) from questionid = i
                 }
                 else
                 {
                     history.Question.RemoveAt(history.Question.Count - 1);
                 }
             }
             SolvedTests.Add(history);
         }
     }
 }
Example #2
0
 public void UpdateWith(Test test, TestSolving.TestResults testResults)
 {
     SolvedTests.Add(test.Id);
     Points.Add(testResults.TotalPoints);
     CorrectAnswers += testResults.CorrectAnswers;
 }