Made competition queries case-insensitive

Updated all the DB queries for competition to be case-insensitive
Updated template to use the pure form style
fixed call to recalculate the rank

Fixed a reference to the function that recalculates the team scoring.
Some other re-factoring changed the signature to this function and one
reference was missed.