make caching still work when there are no view results

also some misc formatting tweaks that snuck in
Merge pull request #161 from dimagi/caching-tweaks

make caching still work when there are no view results