Beispiel #1
0
        //Thread for saving the graded test (and sometimes the practice test
        void backgroundWorkerSaveTest_DoWork(object sender, DoWorkEventArgs e)
        {
            switch (this.Tag.ToString())
            {
            case "placement":

                //just insert the graded test
                MathWizDB.InsertGradedTest(gradedPlacementTest, student.Id, gradedPlacementTest.PlacementTest.Id, "Placement Test", gradedPlacementTest.RecommendedLevel);

                //update student's mastery level
                MathWizDB.UpdateMasteryLevel(student.Username, gradedPlacementTest.RecommendedLevel);

                break;

            case "practice":

                //first insert the test since the teacher did not make it, but the student just generated it
                gradedPracticeTest.PracticeTest.Id = MathWizDB.InsertTest(klass.Id, gradedPracticeTest.PracticeTest, "Practice Test", 0, gradedPracticeTest.PracticeTest.MinLevel, gradedPracticeTest.PracticeTest.MaxLevel);

                //then insert the graded test. The insertGradedTest method also inserts the graded Questions
                gradedPracticeTest.Id = MathWizDB.InsertGradedTest(gradedPracticeTest, student.Id, gradedPracticeTest.PracticeTest.Id, "Practice Test");

                break;

            case "mastery":

                //just insert the graded test
                MathWizDB.InsertGradedTest(gradedMasteryTest, student.Id, gradedMasteryTest.MasteryTest.Id, "Mastery Test", 0, 1, gradedMasteryTest.Passed);

                break;
            }
        }
Beispiel #2
0
        private void btnCreateTest_Click(object sender, EventArgs e)
        {
            btnCreateTest.Text    = "Creating Test";
            btnCreateTest.Enabled = false;

            //if form validation is good then
            if (ValidateForm())
            {
                int      numberOfQuestions      = Convert.ToInt32(cboNumberOfQuestions.SelectedItem);
                int      numberOfQuestionsPerML = numberOfQuestions / 12; //take a few questions from each mastery level
                TimeSpan questionTimeLimit      = new TimeSpan(0, 1, 0);

                PlacementTest placementTest = new PlacementTest();

                for (int ml = 1; ml <= 12; ml++) //get questions from each mastery level
                {
                    //make custom timelimits for each question depending on complexity
                    questionTimeLimit = CalculateQuestionTimeLimit(cboQuestionSpeed.SelectedItem.ToString(), ml);

                    //get the questions for just the current mastery level in this for loop
                    List <Question> tempQuestionList = Question.GenerateRandomQuestions(ml, questionTimeLimit, numberOfQuestionsPerML);

                    foreach (Question q in tempQuestionList) //add current mastery level questions to the actual placement test
                    {
                        placementTest.Questions.Add(q);
                    }
                }

                //set other attributes of the test
                placementTest.MinLevel  = 1;
                placementTest.MaxLevel  = 12;
                placementTest.TimeLimit = TimeSpan.FromTicks(questionTimeLimit.Ticks * numberOfQuestions);

                //insert it
                placementTest.Id = MathWizDB.InsertTest(klassID, placementTest, "Placement Test", 0, placementTest.MinLevel, placementTest.MaxLevel);

                this.Close();

                if (placementTest.Id > 0)
                {
                    MessageBox.Show("Your new randomly generated Placement test has been created");
                }
                else
                {
                    MessageBox.Show("Failed to create placement test", "error");
                }
            }
            else
            {
                MessageBox.Show("A placement test has already been created for this class.", "error");
            }
            btnCreateTest.Text    = "Create Test";
            btnCreateTest.Enabled = true;
        }
Beispiel #3
0
        private void btnGenerateTests_Click(object sender, EventArgs e)
        {
            btnGenerateTests.Text    = "Generating Tests";
            btnGenerateTests.Enabled = false;

            for (int ml = 1; ml <= 12; ml++)
            {
                MasteryTest masteryTest = new MasteryTest();
                int         numberOfQuestions;
                TimeSpan    questionTimeLimit = new TimeSpan(0, 1, 0);
                TimeSpan    testTimeLimit     = new TimeSpan(1, 0, 0);
                decimal     passThreshhold    = 1;

                numberOfQuestions = Convert.ToInt32(cboNumberOfQuestions.SelectedItem);


                switch (cboQuestionSpeed.SelectedItem.ToString())
                {
                case "Slow":

                    if (ml >= 1 && ml <= 3)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 45);
                    }
                    else if (ml >= 4 && ml <= 6)
                    {
                        questionTimeLimit = new TimeSpan(0, 1, 0);
                    }
                    else if (ml >= 7 && ml <= 9)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 45);
                    }
                    else if (ml >= 10 && ml <= 12)
                    {
                        questionTimeLimit = new TimeSpan(0, 3, 0);
                    }

                    break;

                case "Medium":

                    if (ml >= 1 && ml <= 3)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 30);
                    }
                    else if (ml >= 4 && ml <= 6)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 45);
                    }
                    else if (ml >= 7 && ml <= 9)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 30);
                    }
                    else if (ml >= 10 && ml <= 12)
                    {
                        questionTimeLimit = new TimeSpan(0, 2, 0);
                    }

                    break;

                case "Fast":

                    if (ml >= 1 && ml <= 3)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 15);
                    }
                    else if (ml >= 4 && ml <= 6)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 30);
                    }
                    else if (ml >= 7 && ml <= 9)
                    {
                        questionTimeLimit = new TimeSpan(0, 0, 15);
                    }
                    else if (ml >= 10 && ml <= 12)
                    {
                        questionTimeLimit = new TimeSpan(0, 1, 0);
                    }

                    break;
                }

                switch (cboPassThreshhold.SelectedItem.ToString())
                {
                case "70%":

                    passThreshhold = .7m;

                    break;

                case "80%":

                    passThreshhold = .8m;

                    break;

                case "90%":

                    passThreshhold = .9m;

                    break;

                case "95%":

                    passThreshhold = .95m;

                    break;

                case "100%":

                    passThreshhold = 1m;

                    break;
                }

                masteryTest.MasteryLevel      = ml;
                masteryTest.Questions         = Question.GenerateRandomQuestions(ml, questionTimeLimit, numberOfQuestions);
                masteryTest.TimeLimit         = TimeSpan.FromTicks(questionTimeLimit.Ticks * numberOfQuestions);
                masteryTest.PassThreshhold    = passThreshhold;
                masteryTest.RandomlyGenerated = true;

                MathWizDB.InsertTest(klassID, masteryTest, "Mastery Test", masteryTest.PassThreshhold, masteryTest.MasteryLevel, masteryTest.MasteryLevel);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }

            btnGenerateTests.Text    = "Generate Tests";
            btnGenerateTests.Enabled = false;
        }