Here is a nice link to Bert Polk's plumbing tips
I can see why it didn't pass inspection. You can thank him for doing that. There is now way you want that in the floor and covered.
When you started using it, it would have been obvious.
What is below all of this?