Task observer implementation
you can replace if is_complete == true with if is_complete
the only thing that changes is :conditions, tasks = ... should not be inside the if/else
the 3rd case is invalid: completed_date can't be NULL and within a certain range at the same time
use one conditional for the NOT in completed_date IS (NOT) NULL and one for the and DATE ..., and concatenate the sql string then. Then the nested if/else is gone.
the extra query arguments start_date and end_date depend only on start_date &amp;&amp; end_date, so the distinctions should not be in the is_completed conditional.