refactor time select where instead of selecting all visits