if user gets type answer wrong, show correct answer

Users could previously do that by putting the field in the template, but as so
many users think they've hit a bug when they've actually selected the wrong
field to compare to, we force the display of the field content instead.
This commit is contained in:
Damien Elmes 2012-07-04 21:14:40 +09:00
parent b77ab05421
commit fc8ee29ffd

View file

@ -375,6 +375,8 @@ Please run Tools>Maintenance>Empty Cards""")
given = self.typedAnswer given = self.typedAnswer
# compare with typed answer # compare with typed answer
res = self.correct(cor, given) res = self.correct(cor, given)
if cor != given:
res += "<br>" + _("Correct answer was:") + "<br>" + cor
# and update the type answer area # and update the type answer area
return re.sub(self.typeAnsPat, """ return re.sub(self.typeAnsPat, """
<span style="font-family: '%s'; font-size: %spx">%s</span>""" % <span style="font-family: '%s'; font-size: %spx">%s</span>""" %