public void ImportFile(FileInfo file, Main db)
        {
            using (StreamReader sr = file.OpenText())
            {
                string s;
                var count = 0;
                QuizQuestion question = null;
                while ((s = sr.ReadLine()) != null)
                {
                    s = s.Trim();
                    ++count;

                    // Skip Header
                    if (count < 4) { continue; }

                    if (count % 3 == 1)
                    {
                        question = new QuizQuestion();
                        db.QuizQuestions.InsertOnSubmit(question);

                        // Line 1: Question
                        question.Question = s;
                        if (Language != null)
                        {
                            question.Language = Language;
                        }
                        if (Author != null)
                        {
                            question.Author = Author;
                        }
                    }

                    if (count % 3 == 2 && question != null)
                    {
                        // Line 2: Answer (manual work needed)
                        question.Answer = s;
                        db.SubmitChanges();
                    }

                    if (count % 3 == 0 && question != null && question.ID.HasValue && !s.IsNullOrEmpty())
                    {
                        // Line 3: A Hint
                        var hint = new Hint();
                        db.Hints.InsertOnSubmit(hint);

                        hint.Message = s;
                        hint.QuizQuestionID = question.ID.Value;

                        db.SubmitChanges();
                    }
                }

                db.SubmitChanges();
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            QuizQuestion<int> questionA = new QuizQuestion<int>("How many teeth do sharks use in a lifetime?", 30000);
            questionA.ShowType();
            questionA.ShowQandA();

            QuizQuestion<string> questionB = new QuizQuestion<string>("What type of shark swims fastest?", "The short fin mako shark");
            questionB.ShowType();
            questionB.ShowQandA();

            Console.ReadLine();


            QuizQuestion2<int, string, string> question2 = new QuizQuestion2<int, string,string>("Approximately how many shark species exist?", 350, "None of the above", "Cow MIlk");

            question2.ShowTypes();
            question2.ShowQandA();
            Console.ReadLine();
        }
 void Start()
 {
     mCurQuestion = QuizQuestion.GenerateQuestion();
 }
        public async Task <IActionResult> OnGetAsync(string BibleId, int BookNumber, int Chapter, int?VerseNum, bool?BuildQuestion)
        {
            IdentityUser user = await _userManager.GetUserAsync(User);

            PBEUser = await QuizUser.GetOrAddPBEUserAsync(_context, user.Email); // Static method not requiring an instance

            if (!PBEUser.IsValidPBEQuestionBuilder())
            {
                return(RedirectToPage("/error", new { errorMessage = "Sorry! You do not have sufficient rights to add a PBE question" }));
            }

            bool generateQuestion = false;

            if (BuildQuestion.HasValue)
            {
                generateQuestion = (bool)BuildQuestion;
            }
            Question = new QuizQuestion();
            // Setup our PBEBook Object
            Question.BibleId = await QuizQuestion.GetValidBibleIdAsync(_context, BibleId);

            if (generateQuestion)
            {
                BibleVerse verse = await BibleVerse.GetVerseAsync(_context, Question.BibleId, BookNumber, Chapter, (int)VerseNum);

                Question = await Question.BuildQuestionForVerseAsync(_context, verse, 10, Question.BibleId);

                foreach (QuizAnswer Answer in Question.QuizAnswers)
                {
                    AnswerText += Answer.Answer;
                }
            }
            else
            {
                Question.BookNumber = BookNumber;
                Question.Chapter    = Chapter;
                Question.StartVerse = VerseNum ?? 1; // set to 1 if VersNum is Null.
                Question.EndVerse   = VerseNum ?? 1; // set to 1 if VersNum is Null.
                Question.Points     = 0;
            }

            BibleBook PBEBook = await BibleBook.GetPBEBookAndChapterAsync(_context, Question.BibleId, Question.BookNumber, Question.Chapter);

            if (PBEBook == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find the PBE Book." }));
            }

            Question.PopulatePBEQuestionInfo(PBEBook);
            Question.Verses = await Question.GetBibleVersesAsync(_context, false);

            IsCommentary = (Question.Chapter == Bible.CommentaryChapter);
            if (IsCommentary == false)
            {
                ChapterQuestionCount = PBEBook.BibleChapters.Where(c => c.ChapterNumber == Question.Chapter).First().QuestionCount;
            }
            CommentaryQuestionCount = PBEBook.CommentaryQuestionCount;


            // and now we need a Verse Select List
            ViewData["VerseSelectList"]  = new SelectList(Question.Verses, "Verse", "Verse");
            ViewData["PointsSelectList"] = Question.GetPointsSelectList();
            return(Page());
        }
 private void PresentQuestion()
 {
     currentQuestion = questionCollection.GetUnaskedQuestion();
     uiController.SetupUIForQuestion(currentQuestion);
 }
Example #6
0
 public static string SelectRandomCorrectAnswer(QuizQuestion question)
 {
     return(question.CorrectAnswer[new Random().Next(0, question.CorrectAnswer.Length)]);
 }
Example #7
0
        public ActionResult AddQuestions(FormCollection form)
        {
            bool istrue;

            TempData.Keep("quizId");
            if (Request.Form["isPublic"].Contains("true"))
            {
                istrue = true;
            }
            else
            {
                istrue = false;
            }
            Question question = new Question
            {
                Description = Request.Form["Description"],
                Hint        = Request.Form["Hint"],
                Score       = int.Parse(Request.Form["Score"]),
                isPublic    = istrue,
                Optionss    = new List <Options>(),
            };

            if (ModelState.IsValid)
            {
                db.Questions.Add(question);


                bool iso1True = Request.Form["iso1True"] != null ? true : false;
                bool iso2True = Request.Form["iso2True"] != null ? true : false;
                bool iso3True = Request.Form["iso3True"] != null ? true : false;
                bool iso4True = Request.Form["iso4True"] != null ? true : false;

                Options o1 = new Options
                {
                    ans      = Request.Form["o1ans"],
                    isAnswer = iso1True
                };
                Options o2 = new Options
                {
                    ans      = Request.Form["o2ans"],
                    isAnswer = iso2True
                };
                Options o3 = new Options
                {
                    ans      = Request.Form["o3ans"],
                    isAnswer = iso3True
                };
                Options o4 = new Options
                {
                    ans      = Request.Form["o4ans"],
                    isAnswer = iso4True
                };

                question.Optionss.Add(o1);
                question.Optionss.Add(o2);
                question.Optionss.Add(o3);
                question.Optionss.Add(o4);

                string      idd    = User.Identity.GetUserId();
                UserProfile userPr = db.UserProfiles.FirstOrDefault(x => x.AccountId.Equals(idd));
                userPr.Questions.Add(question);
                int qid = (int)(TempData["quizId"]);
                TempData.Keep("quizId");
                Quiz qiz = db.Quizs.FirstOrDefault(x => x.Id == qid);

                userPr.Quizzes.Add(qiz);
                QuizQuestion qq = new QuizQuestion
                {
                    Question = question,
                    Quiz     = qiz
                };
                qiz.QuizQuestions.Add(qq);
                // db.QuizQuestions.Add(qq);
                db.SaveChanges();
                return(RedirectToAction("AddAnother"));
            }
            return(View());
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(string BibleId, int QuizId)
        {
            if (!ModelState.IsValid)
            {
                // Something bad has happened let's go get a new quiz question.
                UserMessage = "Something has gone wrong! We were unable to save the results for that last question";
                return(RedirectToPage("Quiz", new { BibleId, QuizId, Message = UserMessage }));
            }

            IdentityUser user = await _userManager.GetUserAsync(User);

            PBEUser = await QuizUser.GetOrAddPBEUserAsync(_context, user.Email); // Static method not requiring an instance

            if (!PBEUser.IsValidPBEQuizHost())
            {
                return(RedirectToPage("/error", new { errorMessage = "Sorry! You do not have sufficient rights to host a PBE Quiz" }));
            }
            this.BibleId = await Bible.GetValidPBEBibleIdAsync(_context, BibleId);

            // Let's grab the Quiz Object in order to update it.
            Quiz = await _context.QuizGroupStats.FindAsync(QuizId);

            if (Quiz == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd... We were unable to find this Quiz" }));
            }
            if (Quiz.QuizUser != PBEUser)
            {
                return(RedirectToPage("/error", new { errorMessage = "Sorry! Only a Quiz Owner can award points during a Quiz" }));
            }

            // We need to upate the Question object as well so let's go grab it.
            QuizQuestion QuestionToUpdate = await _context.QuizQuestions.FindAsync(Question.Id);

            if (QuestionToUpdate == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd... We were unable to find this Question so we can't update it" }));
            }

            // Now we award the points... let's get this right:
            // Let's prevent posting an anomalous number of points.
            int QuestionPointsPossible = QuestionToUpdate.Points;

            if (Question.PointsAwarded > QuestionPointsPossible)
            {
                Question.PointsAwarded = QuestionPointsPossible;
            }
            if (Question.PointsAwarded < 0)
            {
                Question.PointsAwarded = 0;
            }

            // Update the Quiz Object:
            _context.Attach(Quiz);
            Quiz.PointsPossible += QuestionPointsPossible;
            Quiz.PointsAwarded  += Question.PointsAwarded;
            Quiz.QuestionsAsked += 1;
            Quiz.Modified        = DateTime.Now;

            // Update the Question Object
            _context.Attach(QuestionToUpdate);
            QuestionToUpdate.LastAsked = DateTime.Now;

            // We've had some challenges with users challenging many questions often with no comment.
            // We will do a user check and make sure our user isn't blocked, if they are we silently fail the challenge.
            // TODO: We should revisit the silent fail if it becomes a problem.
            if (Question.Challenged && !PBEUser.IsQuestionBuilderLocked)
            {
                QuestionToUpdate.Challenged       = true;
                QuestionToUpdate.ChallengeComment = Question.ChallengeComment;
                QuestionToUpdate.ChallengedBy     = PBEUser.Email;
            }

            // Save both of these changes.
            await _context.SaveChangesAsync();

            // And next let's make sure we log this event.
            // BUG: Note we've had a pretty significant data bug prior to 6/8/2019 where we were setting Points to the cumulative quizGroupStat.PointsAwarded vs. the non-cumulative PointsAwardedByJudge... so all data prior to this date is wrong.
            await QuestionToUpdate.RegisterEventAsync(_context, QuestionEventType.QuestionPointsAwarded, PBEUser.Id, null, Quiz.Id, Question.PointsAwarded);

            return(RedirectToPage("Quiz", new { BibleId, QuizId }));
        }
Example #9
0
 public IActionResult FinishAddingQ(QuizQuestion model)
 {
     return(AddQuizQuestion(model, ""));
 }
Example #10
0
        public async Task <IActionResult> AddQuestion(int quizId, [FromBody] QuestionArgs data)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            Quiz quiz = await _Db.Quizzes.Include(q => q.Questions).Where(q => q.Id == quizId).FirstOrDefaultAsync();

            if (quiz == null)
            {
                return(NotFound(new ResponseHelper("Something went wrong. Please refresh your browser and try again.", "Unable to find quiz in database")));
            }

            QuizQuestion question = new QuizQuestion
            {
                Quiz            = quiz,
                TrueFalseAnswer = data.TrueFalseAnswer,
                ImageId         = data.Image?.Id,
                AudioId         = data.Audio?.Id,
                Text            = data.Text,
                OrderIndex      = quiz.Questions.Count,
            };

            // Transaction rolls back all changes if a failure occurs halfway through
            using (var transaction = await _Db.Database.BeginTransactionAsync())
            {
                quiz.UpdatedAt = DateTime.UtcNow;

                // Generate question ID
                await _Db.AddAsync(question);

                await _Db.SaveChangesAsync();

                // Generate IDs for each question, update question correctAnswerId
                for (int i = 0; i < data.Answers?.Count; i++)
                {
                    QuizAnswer answer = new QuizAnswer
                    {
                        QuizQuestionId = question.Id,
                        Text           = data.Answers[i].Text,
                        ImageId        = data.Answers[i].Image?.Id
                    };

                    await _Db.AddAsync(answer);

                    await _Db.SaveChangesAsync();

                    if (i == data.CorrectAnswerIndex)
                    {
                        question.CorrectAnswerId = answer.Id;
                    }
                }

                await _Db.SaveChangesAsync();

                transaction.Commit();
            }

            return(Ok());
        }
 public void SaveQuestion(QuizQuestion question)
 {
     _db.Store(question);
 }
Example #12
0
        public ActionResult Results(int id)
        {
            UserSummaryViewModel model = db.Users.Where(u => u.ID == id)
                                         .Select(u => new UserSummaryViewModel
            {
                Name  = u.Name,
                Email = u.Email
            }).SingleOrDefault <UserSummaryViewModel>();

            UserQuiz userQuiz = db.UserQuizs.Where(uq => uq.UserID == id).SingleOrDefault <UserQuiz>();

            List <UserQuizAnswer> userQuizAnswers = db.UserQuizAnswers.Where(ua => ua.UserQuizID == userQuiz.ID)
                                                    .ToList <UserQuizAnswer>();

            model.QuestionsAndAnswers = new List <QuestionsAndAnswersViewModel>();

            foreach (var item in userQuizAnswers)
            {
                QuestionsAndAnswersViewModel data = new QuestionsAndAnswersViewModel();

                QuizAnswer answer = db.QuizAnswers.Where(a => a.ID == item.QuizAnswerID).SingleOrDefault <QuizAnswer>();

                QuizQuestion quizQuestion = db.QuizQuestions.Where(q => q.ID == answer.QuestionID).SingleOrDefault <QuizQuestion>();

                QuizAnswer correctAnswer = db.QuizAnswers.Where(a => a.QuestionID == quizQuestion.ID && a.CorrectAnswer == true).SingleOrDefault <QuizAnswer>();

                if (correctAnswer.AnswerType == "TX")
                {
                    if (correctAnswer.Answer.ToLower() == item.UserQuizText.ToLower())
                    {
                        data.Correct = true;
                    }
                    else
                    {
                        data.Correct = false;
                    }
                }
                else
                {
                    if (answer.ID == correctAnswer.ID)
                    {
                        data.Correct = true;
                    }
                    else
                    {
                        data.Correct = false;
                    }
                }
                data.CorrectAnswer = correctAnswer.Answer;
                data.Question      = quizQuestion.Question;
                if (answer.AnswerType == "TX")
                {
                    data.UserAnswer = item.UserQuizText;
                }
                else
                {
                    data.UserAnswer = answer.Answer;
                }
                data.WhyCorrect = correctAnswer.WhyCorrectAnswer;

                model.QuestionsAndAnswers.Add(data);
            }

            model.NumberOfCorrect   = model.QuestionsAndAnswers.Where(m => m.Correct == true).Count();
            model.NumberOfQuestions = model.QuestionsAndAnswers.Count();

            return(View(model));
        }
Example #13
0
        public ActionResult Save(int id, Question[] questions, QuestionAnswer[][] answers, Tag[][] tags)
        {
            if (questions == null)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Can not save quiz without question."));
            }
            using (var context = new eQuizEntities(System.Configuration.ConfigurationManager.ConnectionStrings["eQuizDB"].ConnectionString))
            {
                var topicId       = context.Topics.First().Id;
                var quizVariantId = 1; /*context.QuizVariants.First(x => x.QuizId == id).Id;*/ //we don't have fk on tblQuiz
                var blockId       = context.QuizBlocks.First(x => x.QuizId == id).Id;
                var newQuestions  = questions.Where(q => q.Id == 0).ToList();

                for (int i = 0; i < questions.Length; i++)
                {
                    var question = questions[i];

                    if (question.Id != 0)
                    {
                        var existedQuestion = context.Questions.FirstOrDefault(x => x.Id == question.Id);
                        if (existedQuestion == null)
                        {
                            return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Question is not found"));
                        }
                        existedQuestion.IsActive           = question.IsActive;
                        existedQuestion.QuestionComplexity = question.QuestionComplexity;
                        existedQuestion.QuestionText       = question.QuestionText;
                        existedQuestion.QuestionTypeId     = question.QuestionTypeId;
                    }
                    else
                    {
                        question.TopicId  = topicId;
                        question.IsActive = true;
                        context.Questions.Add(question);
                    }
                }
                context.SaveChanges();

                for (int i = 0; i < questions.Length; i++)
                {
                    var question = questions[i];

                    if (newQuestions.Contains(question))
                    {
                        var quizQuestion = new QuizQuestion
                        {
                            QuestionId    = question.Id,
                            QuizVariantId = quizVariantId,
                            QuestionOrder = (short)(i + 1),
                            QuizBlockId   = blockId
                        };
                        context.QuizQuestions.Add(quizQuestion);
                    }
                }
                //for delete answer
                for (int i = 0; i < answers.Length; i++)
                {
                    var questionId     = questions[i].Id;
                    var questionAnswer = context.Questions.Include("QuestionAnswers").FirstOrDefault(y => y.Id == questionId).QuestionAnswers.ToList();

                    if (answers[i][0] != null)
                    {
                        for (var qa = 0; qa < answers[i].Length; qa++)
                        {
                            var answer = answers[i][qa];

                            if (answer.Id != 0)
                            {
                                var existedAnswer = context.QuestionAnswers.FirstOrDefault(x => x.Id == answer.Id);

                                if (existedAnswer == null)
                                {
                                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Answer is not found"));
                                }

                                if (questionAnswer.Contains(existedAnswer))
                                {
                                    questionAnswer.Remove(existedAnswer);
                                }
                                //existedAnswer.AnswerOrder = answer.AnswerOrder;
                                //existedAnswer.AnswerText = answer.AnswerText;
                                //existedAnswer.IsRight = answer.IsRight;
                                existedAnswer.QuestionId = answer.QuestionId;
                            }
                            else
                            {
                                //answer.AnswerOrder = (byte)(qa + 1);
                                answer.QuestionId = questions[i].Id;
                                context.QuestionAnswers.Add(answer);
                            }
                        }
                        if (questionAnswer != null)
                        {
                            foreach (var item in questionAnswer)
                            {
                                context.QuestionAnswers.Remove(item);//todo
                            }
                        }
                    }
                    //todo doesn't delete tags

                    if (tags[i][0] != null)
                    {
                        for (int qt = 0; qt < tags[i].Length; qt++)
                        {
                            var tag = tags[i][qt];

                            var existedTag = context.Tags.FirstOrDefault(x => x.Name == tag.Name);

                            var question = context.Questions.FirstOrDefault(x => x.Id == questionId);

                            if (existedTag == null)
                            {
                                context.Tags.Add(tag);
                                question.QuestionTags.Add(new QuestionTag
                                {
                                    Tag = tag
                                });
                            }
                        }
                    }
                }
                context.SaveChanges();
            }
            return(RedirectToAction("Get", new { id = id }));
        }
        public ActionResult ScheduleQuizReq()
        {
            LoginDetails loginDetails = (LoginDetails)Session["loginDetails"];

            if (loginDetails == null)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            int user = (int)Session["user"];

            if (user != 1)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            object o = Session["selectedClass"];

            if (o == null)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            int    id     = (int)o;
            Course course = data.GetCourse(id);

            if (course == null)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }
            if (course.Active == false)
            {
                return(RedirectToAction("PageNotFoundError", "Home"));
            }

            int total;

            if (!int.TryParse(Request["TotalQuestions"], out total))
            {
                ViewBag.IsWrongTotal = true;
                return(View("ScheduleQuiz", course));
            }
            if (total <= 0)
            {
                ViewBag.IsWrongTotal = true;
                return(View("ScheduleQuiz", course));
            }

            Quiz quiz = new Quiz();

            quiz.Title      = Request["Title"];
            quiz.Content    = Request["Content"];
            quiz.TotalMarks = total;
            List <QuizQuestion> questions = new List <QuizQuestion>();

            for (int i = 1; i <= total; i++)
            {
                QuizQuestion question = new QuizQuestion();
                question.Question      = Request["Question" + i];
                question.OptionA       = Request["Q" + i + "OptionA"];
                question.OptionB       = Request["Q" + i + "OptionB"];
                question.OptionC       = Request["Q" + i + "OptionC"];
                question.OptionD       = Request["Q" + i + "OptionD"];
                question.CorrectOption = int.Parse(Request["Correct" + i]);
                question.Marks         = 1;
                questions.Add(question);
            }
            data.AddQiuz(course, quiz, questions);
            return(RedirectToAction("ScheduleQuiz"));
        }
Example #15
0
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            TimeSpan timeLeft = new TimeSpan();

            if (Session["timeLeft"] != null)
            {
                timeLeft = (DateTime)Session["timeLeft"] - DateTime.Now;
                if (timeLeft.Hours <= 0 && timeLeft.Minutes <= 0 && timeLeft.Seconds <= 0)
                {
                    lblTimer.Text          = "Times up!";
                    lblTimerDisplay.Text   = "Times up!";
                    panelQuiz.Visible      = false;
                    panelStartQuiz.Visible = false;
                    panelTimesUp.Visible   = true;

                    //insert attempt
                    int                      quizID          = Convert.ToInt32(Request.QueryString["id"]);
                    User                     currentUser     = (User)Session["currentUser"];
                    QuizResultDAO            qrDAO           = new QuizResultDAO();
                    QuizResultHistoryDAO     qrhDAO          = new QuizResultHistoryDAO();
                    List <QuizResultHistory> userAnswers     = (List <QuizResultHistory>)Session["userAnswers"];
                    QuizQuestion             currentQuestion = (QuizQuestion)Session["previousQuestion"];
                    int                      attempt         = qrDAO.getAttemptForQuiz(quizID, currentUser.getUserID());
                    attempt++;

                    //to calculate score
                    int userScore = calculateScore(userAnswers);

                    //to get all other details needed to insert to QuizResult
                    string grade = "fail";
                    if (checkIfUserPass(quizID, userScore))
                    {
                        grade = "pass";
                    }
                    DateTime currentDate = DateTime.Now.Date;

                    //insert quizResultHistory
                    foreach (QuizResultHistory qrh in userAnswers)
                    {
                        qrhDAO.createQuizResultHistory(qrh);
                    }

                    //insert QuizResult
                    int quizResultID = qrDAO.createQuizResult(currentUser.getUserID(), quizID, userScore, grade, currentDate, attempt);
                    Session["timesUpResultID"] = quizResultID;

                    //check if user can reattempt quiz
                    QuizResult currentResult = qrDAO.getQuizResultByID(quizResultID);
                    Quiz       currentQuiz   = currentResult.getQuiz();
                    if (currentQuiz.getMultipleAttempts().Equals("n"))
                    {
                        int numOfAttempts = qrDAO.getNumberOfAttempts(currentUser.getUserID(), currentQuiz.getQuizID());
                        if (numOfAttempts >= currentQuiz.getNumberOfAttempts())
                        {
                            btnRestartQuiz.Visible = false;
                        }
                    }
                }
                else
                {
                    //lblTimer.Text = timeLeft.Seconds.ToString();
                    lblTimer.Text = timeLeft.ToString(@"hh\:mm\:ss");
                }
            }
        }
Example #16
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            if (rblAnswers.SelectedIndex != -1)
            {
                int  quizID      = Convert.ToInt32(Request.QueryString["id"]);
                User currentUser = (User)Session["currentUser"];
                //handle current question and answer
                QuizDAO              quizDAO         = new QuizDAO();
                QuizResultDAO        qrDAO           = new QuizResultDAO();
                QuizResultHistory    currentAnswer   = new QuizResultHistory();
                QuizResultHistoryDAO qrhDAO          = new QuizResultHistoryDAO();
                QuizQuestionDAO      qqDAO           = new QuizQuestionDAO();
                QuizQuestion         currentQuestion = (QuizQuestion)Session["previousQuestion"];
                Quiz       currentQuiz           = quizDAO.getQuizByID(quizID);
                QuizAnswer currentSelectedAnswer = new QuizAnswer(Convert.ToInt32(rblAnswers.SelectedValue), currentQuestion, rblAnswers.SelectedItem.Text);
                //int attempt = qrhDAO.getAttemptForQuiz(currentQuestion.getQuizQuestionID());
                int attempt = qrDAO.getAttemptForQuiz(quizID, currentUser.getUserID());
                attempt++;
                currentAnswer.setAttempt(attempt);
                currentAnswer.setUserID(currentUser.getUserID());
                currentAnswer.setQuestion(currentQuestion);
                currentAnswer.setAnswer(currentSelectedAnswer);
                currentAnswer.setQuizID(quizID);
                List <QuizResultHistory> userAnswers = (List <QuizResultHistory>)Session["userAnswers"];
                userAnswers.Add(currentAnswer);

                //to calculate score
                int userScore = calculateScore(userAnswers);

                //to get all other details needed to insert to QuizResult
                string grade = "fail";
                if (checkIfUserPass(quizID, userScore))
                {
                    grade = "pass";
                }
                DateTime currentDate = DateTime.Now.Date;

                //insert quizResultHistory
                foreach (QuizResultHistory qrh in userAnswers)
                {
                    qrhDAO.createQuizResultHistory(qrh);
                }

                //insert QuizResult
                int quizResultID = qrDAO.createQuizResult(currentUser.getUserID(), quizID, userScore, grade, currentDate, attempt);

                string displayAnswer = currentQuiz.getDisplayAnswer();
                if (displayAnswer.Equals("always"))
                {
                    Response.Redirect("viewResults.aspx?id=" + quizResultID);
                }
                else if (displayAnswer.Equals("never"))
                {
                    Response.Redirect("noResult.aspx?id=" + quizResultID);
                }
                else
                {
                    if (grade.Equals("pass"))
                    {
                        Response.Redirect("viewResults.aspx?id=" + quizResultID);
                    }
                    else
                    {
                        Response.Redirect("viewMyResult.aspx?id=" + quizResultID);
                    }
                }
            }
        }
Example #17
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                // Setup our PBEBible Object
                Question.BibleId = await QuizQuestion.GetValidBibleIdAsync(_context, Question.BibleId);

                BibleBook PBEBook = await BibleBook.GetPBEBookAndChapterAsync(_context, Question.BibleId, Question.BookNumber, Question.Chapter);

                if (PBEBook == null)
                {
                    return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find the PBE Book." }));
                }

                Question.PopulatePBEQuestionInfo(PBEBook);
                Question.Verses = await Question.GetBibleVersesAsync(_context, false);

                // We should still have AnswerText


                IsCommentary = (Question.Chapter == Bible.CommentaryChapter);
                if (IsCommentary == false)
                {
                    ChapterQuestionCount = PBEBook.BibleChapters.Where(c => c.ChapterNumber == Question.Chapter).First().QuestionCount;
                }
                CommentaryQuestionCount = PBEBook.CommentaryQuestionCount;

                // and now we need a Verse and Points Select List
                ViewData["VerseSelectList"]  = new SelectList(Question.Verses, "Verse", "Verse");
                ViewData["PointsSelectList"] = Question.GetPointsSelectList();
                return(Page());
            }

            // confirm our user is a valid PBE User.
            IdentityUser user = await _userManager.GetUserAsync(User);

            PBEUser = await QuizUser.GetOrAddPBEUserAsync(_context, user.Email);

            if (!PBEUser.IsValidPBEQuestionBuilder())
            {
                return(RedirectToPage("/error", new { errorMessage = "Sorry! You do not have sufficient rights to edit a PBE question" }));
            }

            // Now let's create an empty question and put only our validated properties onto it.
            QuizQuestion QuestionToUpdate = await _context.QuizQuestions.FindAsync(Question.Id);

            if (QuestionToUpdate == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find this Question" }));
            }

            if (await TryUpdateModelAsync <QuizQuestion>(
                    QuestionToUpdate,
                    "Question", // Prefix for form value.
                    Q => Q.BibleId, Q => Q.Points, Q => Q.StartVerse, Q => Q.EndVerse, Q => Q.Question, Q => Q.Challenged, Q => Q.ChallengeComment))
            {
                QuestionToUpdate.Modified = DateTime.Now;

                // now we need to add the Answer if there is one.
                if (AnswerText.Length > 0)
                {
                    // We need the Original Answer and while techincally we support multiple Answers
                    // we are only going to allow operating on the first one in this basic edit experience.
                    await _context.Entry(QuestionToUpdate).Collection(Q => Q.QuizAnswers).LoadAsync();

                    if (QuestionToUpdate.QuizAnswers.Count > 0)
                    {
                        QuizAnswer OriginalAnswer = QuestionToUpdate.QuizAnswers.OrderBy(A => A.Id).First();
                        if (OriginalAnswer.Answer != AnswerText)
                        {
                            _context.Attach(OriginalAnswer);
                            OriginalAnswer.Modified = DateTime.Now;
                            OriginalAnswer.Answer   = AnswerText;

                            QuestionToUpdate.IsAnswered = true;
                        }
                    }
                }
                await _context.SaveChangesAsync();

                switch (ReturnPath)
                {
                case "Questions":
                    return(RedirectToPage("Questions", new { BibleId = QuestionToUpdate.BibleId, BookNumber = QuestionToUpdate.BookNumber, Chapter = QuestionToUpdate.Chapter }));

                // break; not needed unreachable

                case "ChallengedQuestions":
                    return(RedirectToPage("ChallengedQuestions", new { BibleId = QuestionToUpdate.BibleId }));

                // break; not needed unreachable

                default:
                    return(RedirectToPage("AddQuestion", new { BibleId = QuestionToUpdate.BibleId, BookNumber = QuestionToUpdate.BookNumber, Chapter = QuestionToUpdate.Chapter, VerseNum = QuestionToUpdate.EndVerse }));
                    // break; not needed unreachable
                }
            }
            return(RedirectToPage("Index"));
        }
Example #18
0
        public async Task <IActionResult> UpdateQuestion(int quizId, int questionId, [FromBody] QuestionArgs data)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            Quiz quiz = await _Db.Quizzes.FindAsync(quizId);

            QuizQuestion question = await _Db.QuizQuestions.Include(q => q.Answers).Where(q => q.Id == questionId).FirstOrDefaultAsync();

            if (quiz == null || question == null)
            {
                return(NotFound(new ResponseHelper("Something went wrong. Please refresh your browser and try again.", "Unable to find question in database")));
            }

            using (var transaction = await _Db.Database.BeginTransactionAsync())
            {
                question.CorrectAnswerId = null;

                await _Db.SaveChangesAsync();

                _Db.RemoveRange(question.Answers);

                await _Db.SaveChangesAsync();

                question.ImageId         = data.Image?.Id;
                question.Text            = data.Text;
                question.TrueFalseAnswer = data.TrueFalseAnswer;
                question.AudioId         = data.Audio?.Id;

                if (data.Answers != null)
                {
                    foreach (AnswerArgs answerArgs in data.Answers)
                    {
                        QuizAnswer newAns = new QuizAnswer
                        {
                            QuizQuestionId = question.Id,
                            Text           = answerArgs.Text,
                            ImageId        = answerArgs.Image?.Id
                        };

                        await _Db.AddAsync(newAns);

                        await _Db.SaveChangesAsync();

                        if (data.Answers.IndexOf(answerArgs) == data.CorrectAnswerIndex)
                        {
                            question.CorrectAnswerId = newAns.Id;
                        }
                    }
                }

                quiz.UpdatedAt = DateTime.UtcNow;

                await _Db.SaveChangesAsync();

                transaction.Commit();
            }

            return(Ok());
        }
 public void AddQuestion(QuizQuestion question)
 {
     _db.Store(question);
 }
    void Update()
    {
        if (RaceManager.Instance != null &&
            RaceManager.Instance.State == RaceManager.RaceState.Playing)
        {
            RaceManager.Instance.UpdateSelf(Time.deltaTime, 0);

            if (mShowingFeedback)
            {
                mNextQuestionCountdown -= Time.deltaTime;
                if (mNextQuestionCountdown < 0 || mCurQuestion == null)
                {
                    mCurQuestion = QuizQuestion.GenerateQuestion();
                    mQuestionValue = MaxPointsPerQuestion;
                    mShowingFeedback = false;
                    PlaySfx(QuestionClip);
                }
            }
            else
            {
                mQuestionValue -= PointDecreaseSpeed * Time.deltaTime;
                if (mQuestionValue < MinPointsPerQuestion)
                {
                    mQuestionValue = MinPointsPerQuestion;
                }
            }
        }
    }
Example #21
0
 public QuizQuestionViewModel(QuizQuestion quizQuestion, bool?response)
 {
     this.Response     = response;
     this.quizQuestion = quizQuestion;
 }
Example #22
0
 public QuizRepository(QuizContext quizContex, QuizQuestion quizQuestion)
 {
     this.quizContext  = quizContex;
     this.quizQuestion = quizQuestion;
 }
Example #23
0
 public IActionResult AddQuizQuestion(QuizQuestion model)
 {
     return(View(model));
 }
Example #24
0
 public void AddQuizQuestion(QuizQuestion quizquestion)
 {
     Context.Add(quizquestion);
     Context.SaveChanges();
 }
Example #25
0
 /// <summary>
 /// Check whether the supplied answer index matches the question's correct answer.
 /// </summary>
 /// <param name="a">Index of your answer, corresponds to QuizQuestion's answers list.</param>
 /// <param name="q">Original question containing all the possible answers and the correct one.</param>
 /// <returns></returns>
 bool IsCorrectAnswer(int a, QuizQuestion q)
 {
     return(q.Answers[a] == q.CorrectAnswer);
 }
Example #26
0
        public static void  Seed()
        {
            using var _ctx = new BoraNowContext();
            _ctx.Database.EnsureDeleted();
            _ctx.Database.EnsureCreated();
            var categoryOne     = new CategoryInterestPoint("VeganFood");
            var categoryTwo     = new CategoryInterestPoint("SeaFood");
            var categoryThree   = new CategoryInterestPoint("AsianFood");
            var quiz            = new Quiz("BoraNow quiz");
            var quizQuestion    = new QuizQuestion("What type of food are you looking for?", quiz.Id);
            var quizAnswerOne   = new QuizAnswer("Vegan", quizQuestion.Id);
            var quizAnswerTwo   = new QuizAnswer("Sea food", quizQuestion.Id);
            var quizAnswerThree = new QuizAnswer("Asian style", quizQuestion.Id);


            var countryOne = new Country("Angola");
            var countryTwo = new Country("Portugal");
            var profileOne = new Profile("blogueira vegana que adora viajar e conhecer novos locais", "mefamousstar.jpg");
            var profileTwo = new Profile("Business Man with a chain of restauarants across Lisbon", "merichstar.jpg");
            var company    = new Company("PearTree Company", "Marco Pereria", "919200000", "23453554", profileTwo.Id);
            var visitor    = new Visitor("Bruna", "Costa", DateTime.Now.AddYears(-24), "Female", profileOne.Id, countryOne.Id);


            var interestPoint         = new InterestPoint("PearTree Abc", "very chill place that offers lots off tradicional food", "abc street", "uhuhuu.jpg", "3 am", "5 pm", "fridays", true, true, company.Id);
            var interestPointCategory = new InterestPointCategoryInterestPoint(interestPoint.Id, categoryOne.Id);
            var result = new Result("questionário nº 1", DateTime.Now, quiz.Id, visitor.Id);
            var resultInterestPoint = new ResultInterestPoint(result.Id, interestPoint.Id);

            var newsletter = new Newsletter("New place in town that has many vegan options", "Brand New");
            var interestPointNewsletter = new InterestPointNewsletter(interestPoint.Id, newsletter.Id);

            var meteorology = new Meteorology(19, 27, 0, 1, 0, DateTime.Now.AddDays(1));
            var feedback    = new Feedback("very nice place, cousy vibes, really good food", 5, DateTime.Now.AddDays(-1), interestPoint.Id, visitor.Id);



            _ctx.Country.AddRange(countryOne);
            _ctx.Country.AddRange(countryTwo);
            _ctx.Profile.AddRange(profileOne);
            _ctx.Profile.AddRange(profileTwo);
            _ctx.Company.AddRange(company);
            _ctx.Visitor.AddRange(visitor);

            _ctx.Category.AddRange(categoryOne);
            _ctx.Category.AddRange(categoryTwo);
            _ctx.Category.AddRange(categoryThree);
            _ctx.Quiz.AddRange(quiz);
            _ctx.QuizQuestion.AddRange(quizQuestion);
            _ctx.QuizAnswer.AddRange(quizAnswerOne);
            _ctx.QuizAnswer.AddRange(quizAnswerTwo);
            _ctx.QuizAnswer.AddRange(quizAnswerThree);
            _ctx.InterestPoint.AddRange(interestPoint);
            _ctx.InterestPointCategory.AddRange(interestPointCategory);
            _ctx.Result.AddRange(result);
            _ctx.ResultInterestPoint.AddRange(resultInterestPoint);

            _ctx.Newsletter.AddRange(newsletter);
            _ctx.InterestPointNewsletter.AddRange(interestPointNewsletter);

            _ctx.Feedback.AddRange(feedback);
            _ctx.Meteorology.AddRange(meteorology);

            _ctx.SaveChanges();
        }
Example #27
0
        public static string[] SelectIncorrectAnswers(QuizQuestion question, int amount = 3)
        {
            Random rnd = new Random();

            return(question.IncorrectAnswers.OrderBy(x => rnd.Next()).Take(amount).ToArray());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            /* Parse teacherId & quizId
             * teacherId - Integer >= 1
             * quizId - Integer >= 1
             */
            int teacherId = -1;
            int quizId    = -1;

            try
            {
                if (string.IsNullOrEmpty(Request.QueryString["teacherId"]) ||
                    string.IsNullOrEmpty(Request.QueryString["quizId"]))
                {
                    throw new Exception();
                }

                teacherId = Int32.Parse(Request.QueryString["teacherId"]);
                quizId    = Int32.Parse(Request.QueryString["quizId"]);

                if (teacherId < 1 || quizId < 1)
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                loadError.Visible = true;
                quizView.Visible  = false;
                return;
            }

            var db = new DatabaseEntities();

            var quiz = db.Quiz.Where(q => q.id == quizId && q.teacherId == teacherId).Single();

            quizTitle.InnerText = quiz.title;

            var questions = db.Question.Where(i => i.quizId == quizId && i.teacherId == teacherId).ToArray();

            foreach (var question in questions)
            {
                if (question.type == "Multiple Choice")
                {
                    question.QuestionOption = db.QuestionOption.Where(qo => qo.quizId == quizId &&
                                                                      qo.teacherId == teacherId && qo.questionId == question.id).ToArray();
                }

                var quizQuestion = new QuizQuestion
                {
                    question = question
                };

                quizQuestionsView.Controls.Add(quizQuestion);
            }
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                // Setup our PBEBible Object
                Question.BibleId = await QuizQuestion.GetValidBibleIdAsync(_context, Question.BibleId);

                BibleBook PBEBook = await BibleBook.GetPBEBookAndChapterAsync(_context, Question.BibleId, Question.BookNumber, Question.Chapter);

                if (PBEBook == null)
                {
                    return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find the PBE Book." }));
                }

                Question.PopulatePBEQuestionInfo(PBEBook);
                Question.Verses = await Question.GetBibleVersesAsync(_context, false);


                IsCommentary = (Question.Chapter == Bible.CommentaryChapter);
                if (IsCommentary == false)
                {
                    ChapterQuestionCount = PBEBook.BibleChapters.Where(c => c.ChapterNumber == Question.Chapter).First().QuestionCount;
                }
                CommentaryQuestionCount = PBEBook.CommentaryQuestionCount;

                // and now we need a Verse and Points Select List
                ViewData["VerseSelectList"]  = new SelectList(Question.Verses, "Verse", "Verse");
                ViewData["PointsSelectList"] = Question.GetPointsSelectList();
                return(Page());
            }

            // confirm our user is a valid PBE User.
            IdentityUser user = await _userManager.GetUserAsync(User);

            if (User != null)
            {
                PBEUser = await QuizUser.GetOrAddPBEUserAsync(_context, user.Email);

                if (!PBEUser.IsValidPBEQuestionBuilder())
                {
                    return(RedirectToPage("/error", new { errorMessage = "Sorry! You do not have sufficient rights to add a PBE question" }));
                }
            }
            else
            {
                return(RedirectToPage("/error", new { errorMessage = "Oops! We were unable to get our User Object from the UserManager, this question cannot be added!" }));
            }

            // Now let's create an empty question and put only our validated properties onto it.
            var emptyQuestion = new QuizQuestion
            {
                Created  = DateTime.Now,
                Modified = DateTime.Now
            };

            if (await TryUpdateModelAsync <QuizQuestion>(
                    emptyQuestion,
                    "Question", // Prefix for form value.
                    Q => Q.BibleId, Q => Q.Points, Q => Q.BookNumber, Q => Q.Chapter, Q => Q.StartVerse, Q => Q.EndVerse, Q => Q.Question))
            {
                emptyQuestion.Owner  = PBEUser.Email;
                emptyQuestion.Source = "BiblePaths.Net";
                _context.QuizQuestions.Add(emptyQuestion);

                // now we need to add the Answer if there is one.
                if (AnswerText.Length > 0)
                {
                    QuizAnswer Answer = new QuizAnswer
                    {
                        Created   = DateTime.Now,
                        Modified  = DateTime.Now,
                        Question  = emptyQuestion,
                        Answer    = AnswerText,
                        IsPrimary = true
                    };
                    _context.QuizAnswers.Add(Answer);
                    // Register that this question has an answer.
                    emptyQuestion.IsAnswered = true;
                }
                await _context.SaveChangesAsync();

                return(RedirectToPage("AddQuestion", new { BibleId = emptyQuestion.BibleId, BookNumber = emptyQuestion.BookNumber, Chapter = emptyQuestion.Chapter, VerseNum = emptyQuestion.EndVerse }));
            }
            else
            {
                return(RedirectToPage("/error", new { errorMessage = "Oops! We failed to update the question model, this question cannot be added!" }));
            }
            // return RedirectToPage("Index");
        }
        public void DeterimeCorrectAnswerTest()
        {
            QuizQuestion questionFour = new QuizQuestion("Question 3?|Answer One|Answer Two|Answer Three*|Answer Four");

            Assert.AreEqual("Answer Three", questionFour.CorrectAnswer, "Correct answer is set and formatted properly");
        }
        public HttpResponseMessage Get()
        {
            JsonResponse Response = new JsonResponse(true, new SecureContext());

            Response.Create();

            if (Response.IsAuthentic == true)
            {
                List <Quiz> Output = new List <Quiz>();

                var Source = Umbraco.Content(1123).Children().Where("Visible");

                // Sort parameter
                Int32.TryParse(HttpContext.Current.Request.QueryString["id"], out int QuizId);

                if (Source.Count() > 0)
                {
                    foreach (var Node in Source)
                    {
                        if (QuizId != 0 && Node.Id != QuizId)
                        {
                            continue;
                        }
                        Quiz Quiz = new Quiz
                        {
                            ID                = Node.Id,
                            Title             = Node.GetPropertyValue("title"),
                            IsLockedByDefault = (bool)Node.GetPropertyValue("isLockedByDefault"),
                            Questions         = new List <QuizQuestion>(),
                            Image             = "https://www.jirikralovec.cz/dev/givskud/images/demo-animalimage.jpg"
                                                // Image = "https://" + HttpContext.Current.Request.Url.Host + Node.GetPropertyValue("image").Url
                        };
                        // Individual questions
                        IEnumerable <IPublishedContent> Questions = Node.GetPropertyValue("questions");
                        foreach (IPublishedContent Q in Questions)
                        {
                            QuizQuestion QQ = new QuizQuestion
                            {
                                Question      = (string)Q.GetPropertyValue("questionText"),
                                Answers       = new Dictionary <int, string>(),
                                CorrectAnswer = (int)Q.GetPropertyValue("correctAnswer")
                            };
                            string[] Answers = (string[])Q.GetPropertyValue("answers");
                            if (Answers.Count() > 0)
                            {
                                for (int i = 0; i < Answers.Count(); i++)
                                {
                                    QQ.Answers.Add(i, Answers[i]);
                                }
                            }
                            Quiz.Questions.Add(QQ);
                        }
                        Output.Add(Quiz);
                    }
                }

                Response.Set(new StringContent(JsonConvert.SerializeObject(Output), ApiContext.GetEncoding(), ApiContext.GetOutputType()));
            }

            return(Response.Get());
        }
 void Start()
 {
     mCurQuestion = QuizQuestion.GenerateQuestion();
 }
        public void ImportFile(FileInfo file, Main db)
        {
            using (StreamReader sr = file.OpenText())
            {
                string s;
                QuizQuestion question = null;
                bool category = false;
                while ((s = sr.ReadLine()) != null)
                {
                    s = s.Trim();
                    if (s.StartsWith("#") || s.IsNullOrEmpty()) { continue; }

                    if (s.StartsWith("Category:"))
                    {
                        question = new QuizQuestion();
                        db.QuizQuestions.InsertOnSubmit(question);

                        question.Category = s.Substring(9);
                        category = true;
                    }

                    if (s.StartsWith("Question:") && question != null)
                    {
                        if (!category)
                        {
                            question = new QuizQuestion();
                            db.QuizQuestions.InsertOnSubmit(question);
                        }
                        category = false;
                        question.Question = s.Substring(9).Trim();
                    }

                    if (s.StartsWith("Answer:") && question != null)
                    {
                        question.Answer = s.Substring(7).Trim();
                        db.SubmitChanges();
                    }

                    if (s.StartsWith("Regexp:") && question != null)
                    {
                        question.AnswerRegExp = s.Substring(7).Trim();
                    }

                    if (s.StartsWith("Author:") && question != null)
                    {
                        question.Author = s.Substring(7).Trim();
                    }

                    if (s.StartsWith("Level:") && question != null)
                    {
                        switch (s.Substring(6).Trim())
                        {
                            case "baby":
                                question.Difficulty = 0;
                                break;
                            case "easy":
                                question.Difficulty = 3;
                                break;
                            case "normal":
                                question.Difficulty = 5;
                                break;
                            case "hard":
                                question.Difficulty = 8;
                                break;
                            case "extreme":
                                question.Difficulty = 10;
                                break;

                        }
                    }

                    if (s.StartsWith("Comment:") && question != null)
                    {
                        question.Comment = s.Substring(8).Trim();
                    }

                    if (s.StartsWith("Score:") && question != null)
                    {
                        question.Score = int.Parse(s.Substring(6).Trim());
                    }

                    if (s.StartsWith("Tip:") && question != null && question.ID.HasValue && !s.IsNullOrEmpty())
                    {
                        var hint = new Hint();
                        db.Hints.InsertOnSubmit(hint);

                        hint.Message = s.Substring(4).Trim();
                        hint.QuizQuestionID = question.ID.Value;

                        db.SubmitChanges();
                    }
                }
            }
        }
Example #34
0
 public void AddQuestion(QuizQuestion q)
 {
     db.QuizQuestions.Add(q);
 }
Example #35
0
 public void RemoveQuestion(QuizQuestion q)
 {
     db.QuizQuestions.Remove(q);
 }
    //Handles game play during Update()
    void HandleGamePlay()
    {
        if (mCurQuestion == null) {
            Debug.Log ("Generating question");
            mCurQuestion = QuizQuestion.GenerateQuestion ();
        }

        RaceManager.Instance.UpdateSelf (Time.deltaTime, 0);
        if (mShowingFeedback) {
            mNextQuestionCountdown -= Time.deltaTime;
            if (mNextQuestionCountdown < 0 || mCurQuestion == null) {
                mCurQuestion = QuizQuestion.GenerateQuestion ();
                mQuestionValue = MaxPointsPerQuestion;
                mShowingFeedback = false;
                PlaySfx (QuestionClip);
            }
        } else {
            ShowQuestion ();
            mQuestionValue -= PointDecreaseSpeed * Time.deltaTime;
            if (mQuestionValue < MinPointsPerQuestion) {
                mQuestionValue = MinPointsPerQuestion;
            }
        }
    }