Treatment of competition between complete fusion and quasifission in collisions of heavy nuclei