Fixed bugs on teacher XY module

MySQL query failed when teacher had not assigned their initial XY
course to a date. This then caused the delete fail due to a variable
dependence.