• Resolved palmstone

    (@palmstone)


    I am creating a quiz with both multiple choice and open-ended (text) answers. I’ve tested the feature with the open-ended text and there is no way that users will write a similar enough answer to get it correct. Is there a way that I can exclude the open-ended (text) questions from the scoring? In other words, those questions aren’t marked as correct or incorrect?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Harmonic Design

    (@harmonic_design)

    Hi palmstone, do you want those questions to still be marked, but excluded from the score, or do you not want them to be marked at all?

    This is not something that HD Quiz does by default. All questions are marked and included in the score. However, I built in a lot of hooks into HD Quiz that we can use to modify behaviour. In your case, we can use the hdq_submit action to hook into quiz completion. We can then loop through all of the text based answer questions and remove their marking from the total score.

    I could send you the code for this, but A) I need to know exactly what you are looking for (see first paragraph), and B) it’s not something I’ll be able to provide soon. You’ll need to wait for next week.

    In the meantime, I just want to let you know that the text based answers were meant for single word answers more than sentences. They are also compatible with stemming. Stemming is used by adding an * asterisk to the end of the word so that any letters after will be allowed. Example: using ho* as one of your allowed answers means that horses, hop, hope, hole, holes etc would all be accepted answers. Maybe this will help you use that question type as is.

    Thread Starter palmstone

    (@palmstone)

    Thank you so much for your quick response!!!

    1. I want all text answers to be excluded from both marking and scoring. We simply want people to be able to write an answer (I do take note of the possibility of single word answers and will certainly use that option on future quizzes).

    2. Waiting until you have time to provide the code is not a problem!

    3. Is there a place where we can send you a donation? Your Quiz program is remarkably user friendly. Love it.

    Plugin Author Harmonic Design

    (@harmonic_design)

    1. Ok thanks for the answer, that shouldn’t be a problem.
    2. Great! Expect a response early next week.
    3. You can consider purchasing one of the addons (Styler Addon or Save Results Pro) so that you also get utility. If not, I always welcome positive reviews πŸ™‚
    Plugin Author Harmonic Design

    (@harmonic_design)

    As promised, here is the code you will need: https://pastebin.com/raw/AFx7ntZu

    This code should be added to your theme’s functions.php file. The safest place to add it is immediately at the top of the file after the opening <?php tag. ALWAYS make sure to back up this file first, as if you make a mistake, it will crash your entire site.

    WHAT DOES THIS CODE DO?

    This code hooks into HD Quiz to extend functionality. The first function allows us to add custom content after each quiz. This is great because it means that our custom code will only ever run or even load on pages with quizzes. The second function tells HD Quiz to run a custom function once a quiz has been submitted.

    Inside that first function, we have two new JavaScript functions that load on all pages with a quiz.

    The first function (hdq_palmstone_stop_text_answers_from_being_marked) is just there in case you are using the “immediately mark” feature. What it does is “listen” for when a text as answer question has been completed by a user. HD Quiz would then mark the answers, but our custom code hides this marking after a 10milisecond delay.

    The second function (hdq_palmstone_on_submit) is the function that runs once a quiz has been submitted. What it does is loop through all of the questions and finds the ones that are the text based ones. It then undoes any visual marking and updates the scores as needed to A) reduce the score if the text answer was correct and B) reduce the total question count. Finally, we update the score label on the results section to show our updated score.

    Thread Starter palmstone

    (@palmstone)

    Thank you for the code. I’ve put it into my theme functions.php file directly after <?php

    Let me know if that is the correct location.

    If so, then the open-ended text questions are still being marked incorrect when answered.

    Please advise.

    Plugin Author Harmonic Design

    (@harmonic_design)

    Can you show me a link to an active quiz? I can take a look and verify

    Thread Starter palmstone

    (@palmstone)

    The quiz can be found at:

    https://ichetuckneealliance.org/water-quiz

    The open-ended questions are on the second page. At the moment there are no “answers” given in the back-end, but it makes no difference. Either way the entry is marked red. I don’t think they are tabulating in the incorrect answers, so that part of the code is functioning.

    Thank you for your help! If this can’t be fixed we will proceed anyway and just warn people in the instructions.

    Plugin Author Harmonic Design

    (@harmonic_design)

    Ah I see the issue. The code I sent you has the following line

    //hdq_palmstone_stop_text_answers_from_being_marked();

    The double // slashes means that the line has been “commented out” so that it does not run. I had this commented out because I was unsure what quiz settings you had enabled, so didn’t want this to run if it didn’t need to.

    I neglected to inform you before, but if you are using the “immediately mark” feature, then you will need to uncomment that line. You do this by simply removing the double slashes.

    Thread Starter palmstone

    (@palmstone)

    Beautiful!!! Works perfectly.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Exclude Open-ended questions from scoring’ is closed to new replies.