If you have any questions you would like to contribute to any of the consolidation questions, this page will help generate the code needed to include them. Alternatively, you can simply suggest a question at:
https://github.com/Reading-Psych/jast/discussions/categories/suggest-content
If you would like to generate the code, please complete the following inputs:
Give your question a unique name. It cannot have a space in it, so use underscores (e.g. “question_1” rather than “question 1”)
viewof question_name = Inputs. text ();
Write the question itself here:
viewof question_text = Inputs. text ();
What type of question is it?
viewof question_type = Inputs. radio ([
"Multiple choice" ,
"Numeric" ,
"Text"
]);
If you selected multiple choice, write the options you would like the user to choose from. Please put a | (known as a “pipe”) character between each option
viewof question_responses = Inputs. text ();
What is the correct answer? Be precise in how it’s written.
viewof question_correct = Inputs. text ();
output_string = {
var accuracy_code = "correct_" + question_name + " = '" + question_correct + "'; \n " +
question_name + "_result = { \n " +
" if(" + question_name + "_response == correct_" + question_name + "){ \n " +
" return 'Correct!'; \n " +
" } else { \n " +
" return 'Incorrect or incomplete.'; \n " +
" }; \n " +
"} \n " +
"``` \n " +
"**${" + question_name + "_result}**" ;
switch (question_type){
case "Multiple choice" :
return question_text + " \n " +
"```{ojs} \n " +
"//| echo: false \n " +
"viewof " + question_name + "_response = Inputs.radio(['" + question_responses. split ("|" ). join ("','" ) + "']); \n " +
accuracy_code;
break ;
case "Numeric" :
return question_text + " \n " +
"```{ojs} \n " +
"//| echo: false \n " +
"viewof " + question_name + "_response = Inputs.number(); \n " +
accuracy_code;
break ;
case "Text" :
return question_text + " \n " +
"```{ojs} \n " +
"//| echo: false \n " +
"viewof " + question_name + "_response = Inputs.text(); \n " +
accuracy_code;
break ;
}
}