Fix for dupes in the calibrationhistory table

Adds a unique contraint to student_id, location on calibrationhistory.
Catches exception if database exception triggered on get_or_create of
calibrationhistory.
Added a somewhat perfunctory test.