If they're replacing the halfshaft and the flange it suggests that the splines may be the problem. This may also explain why it moves sometimes and not others - sometimes the splines are slipping and sometimes catching, which is not unusual when things are just on the point of stripping completely. It's hard to tell when a halfshaft is about to snap as this is often sudden, but when you look at your drive flanges and drive shafts you'll get some idea of how worn they are. If the profile looks a bit like a circular saw then they're worn. They've got to do quite a bit of work as they're what pushes the car along. So it's a good idea to make sure they've got some lubrication. As standard there is a plastic cap to keep the grease in and the dirt out, and you can get aftermarket ones with a screw on cap so you can put some oil in to keep the splines moist.