Trying to add functionality to hide multiple tables with hidden tbody

Trying to add functionality to hide multiple tables with hidden tbody

This code works but I'm having trouble figuring out how I can get this to work when multiple tables have hidden tbody. Right now, if there is at least 1 table with 1 row visible, then tables with hidden rows won't get hidden because the function isn't being applied to each table...Sunday  at 7:00 for example.