instructure/canvas-lms — pull request #483 by jsupersample (2014-07-23 18:49:36+00:00)
Title: Fixed error handling copying formula question

Fixed an error in handling copying formula question types with an error margin expressed in percentage. When this question type is copied to another course, the field is run through .to_f() which truncates the percent sign, so an error margin of 10% becomes an error margin of 10. CalculatedInteraction uses .to_f for most of its text to float conversion, but a special case needs to be introduced for this expression. This change intercepts a field that ends with a percent sign (and looks like a percentage) skips the conversion. This will work to a percision of two decimal places and up to 100%.

Test Plan:
- Create two courses, CourseA and CourseB.
- In CourseA, create a quiz which contains a formula question type.
- Set the error margin to a percentage (e.g. 1%) and add the question.
- In CourseB, copy the quiz from CourseA using “Import Content” with a content type of “Copy a Canvas Course” and at least selecting quizzes.
- Observe in CourseB that the imported quiz will have a tolerance of 1 instead of 1%.