Fix error from last commit

Update stored procs for TaskBadgeRestrictions. Updates getTopTasks,
getLatestAvailableTasks and getTaggedTasks stored procs. Adds
score based ordering to tagged tasks and full support for task
badge restrictions. Fixes #653. Fixes #584