You would think that anything electrical used around water would have a ground fault interrupter (GFI). I wonder if this was “up to code”, or some sort of DIY cock up. Or an unscrupulous or incompetent contractor.
This happened to my sister when she bought a home with an inground pool.
Electrician wired things incorrectly, causing a current to flow through the water.
The next one came out and MacGyvered the thing, despite my sister insisting she wanted everything to code.
She had to toss him off the job and hired a 3rd electrician. He tore out the garbage work and redid everything to code. No more shocks in the water.