## The hinter module passes in a field called ${op}, which determines which ## sub-function to render. <%def name="get_hint()"> % if len(hints) > 0:

Hints from students who made similar mistakes:

% endif <%def name="get_feedback()"> <% def unspace(in_str): """ HTML id's can't have spaces in them. This little function removes spaces. """ return ''.join(in_str.split()) # Make a list of all hints shown. (This is fed back to the site as pk_list.) # At the same time, determine whether any hints were shown at all. # If the user never saw hints, don't ask him to vote. import json hints_exist = False pk_list = [] for answer, pk_dict in answer_to_hints.items(): if len(pk_dict) > 0: hints_exist = True for pk, hint_text in pk_dict.items(): pk_list.append([answer, pk]) json_pk_list = json.dumps(pk_list) %>

Optional. Help us improve our hints! Which hint was most helpful to you?

% for answer, pk_dict in answer_to_hints.items(): % for hint_pk, hint_text in pk_dict.items():

${hint_text}

% endfor % endfor

Don't like any of the hints above? Write your own!

% if hints_exist:

Choose the incorrect answer for which you want to write a hint:

% else:

Optional. Help other students by submitting a hint! Pick one of your previous answers for which you would like to write a hint:

% endif % for answer in user_submissions: ${answer}
% endfor % if hints_exist:

Back

% endif

Write a hint for other students who get the wrong answer of .

Read about what makes a good hint.



Back

<%def name="show_votes()"> % if hint_and_votes is UNDEFINED: Sorry, but you've already voted! % else: Thank you for voting!
% for hint, votes in hint_and_votes: ${votes} votes. ${hint}
% endfor % endif <%def name="simple_message()"> ${message} % if op == "get_hint": ${get_hint()} % endif % if op == "get_feedback": ${get_feedback()} % endif % if op == "submit_hint": ${simple_message()} % endif % if op == "error": ${error} % endif % if op == "vote": ${show_votes()} % endif