cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Surveyor

Formula questions with externally generated solution tables?

I have a question regarding 'formula' questions in Canvas quizzes (I'm using 'old' quizzes, but if there is a solution in new quizzed I'd be open to hearing it). The set of math functions available in Canvas formula questions is rather limited, which presents a pretty serious constraint on the questions I can ask. Is there a functionality where, instead of using Canvas random numbers and formulas to generate a list of variable values and a solution, I just upload a table of variable values and solutions that I generated in outside software? Then I could compute a set of randomized values and solutions using more advanced software and just upload it into the problem. This would allow me to include problems with more advanced math.

0 Kudos
1 Reply
Highlighted
Navigator

dssimmons@usf.edu 

The functionality to programmatically create your own questions is supported through the Quiz Questions API. Unfortunately, the documentation in the API on what the questions should look like is lacking. What I need a better explanation, I typically do is go into Canvas, do what I'm going to do, and then open the browser developer tools (F12 in Chrome and Firefox). Then I switch to the network tab, keep (persist) the logs, and then click the button inside Canvas to see what is sent to the network.

Given this setup

354277_pastedImage_3.png

Here is what is sent (I stopped it after 4 items, it continues for the 10 I generated)

question[question_name]: Question
question[assessment_question_id]:
question[question_type]: calculated_question
question[points_possible]: 1
question[correct_comments_html]:
question[incorrect_comments_html]:
question[neutral_comments_html]:
question[question_text]: <p>What is [a] + [b] ?</p>
question[regrade_option]:
question[position]: 0
question[text_after_answers]:
question[matching_answer_incorrect_matches]:
question[formulas][]: c=a-b
question[formulas][]: a+b
question[variables][0][name]: a
question[variables][0][min]: 1
question[variables][0][max]: 10
question[variables][0][scale]: 0
question[variables][1][name]: b
question[variables][1][min]: 20
question[variables][1][max]: 30
question[variables][1][scale]: 0
question[answer_tolerance]: 5
question[formula_decimal_places]: 0
question[answers][0][variables][0][name]: a
question[answers][0][variables][0][value]: 4
question[answers][0][variables][1][name]: b
question[answers][0][variables][1][value]: 21
question[answers][0][answer_text]: 25
question[answers][1][variables][0][name]: a
question[answers][1][variables][0][value]: 9
question[answers][1][variables][1][name]: b
question[answers][1][variables][1][value]: 28
question[answers][1][answer_text]: 37
question[answers][2][variables][0][name]: a
question[answers][2][variables][0][value]: 5
question[answers][2][variables][1][name]: b
question[answers][2][variables][1][value]: 23
question[answers][2][answer_text]: 28
question[answers][3][variables][0][name]: a
question[answers][3][variables][0][value]: 7
question[answers][3][variables][1][name]: b
question[answers][3][variables][1][value]: 21
question[answers][3][answer_text]: 28

Note that if you edit the questions in Canvas to the point that you have to regenerate them, you will lose all of your customization, but you can use the Canvas API to edit a quiz question as well.

Interestingly, the table that you see at the bottom of the formula question after you generate it is sent -- as is -- to Canvas when creating the question. You could even replace those values with your table before hitting the update button. I wrote a blog post describing this that may help: Using Calculated Values in the Text of Formula Questions 

0 Kudos
Labels