Yes, I also consider that the mass is not attached to the spring as you push the mass towards it.
Harupex, you are right, that is why I only consider the spring in the first stage, as it's pushing forwards.
Simon, I consider the height 0 when the spring is compressed, so that the potential...