YaleSTC / shifts

Application to easily track shifts, reports, and payforms for employees.
MIT License
23 stars 18 forks source link

Data Entry content parser crashes on mal-formatted input #442

Closed njlxyaoxinwei closed 9 years ago

njlxyaoxinwei commented 9 years ago

When updating Data Objects, DataEntry#write_content creates the content column in a very specific format according to the display_type of the associated data_field. The information is retrieved and parsed by DataEntry#data_fields_with_contents method, called in various views of data_objects.

However, if the display_type of a data_field in some data_type gets changed (i.e. updated), the parser will try to parse the data_entry content with respect to the new data_field display_type, and this can potentially lead to crashes.

This commit fixes the issue by checking more cases and catching errors. It should be cherry-picked into the Shifts3 as well.

njlxyaoxinwei commented 9 years ago

Done! PR #443