Fix off by one in percertage complete calculations

Was causing NaN FloatDomainError when only 1 row was
in table.
Clean up logic in percentage calculation