For me the problem was definitely NOT the battery needing a tighter fit; the switch had unscrewed a bit and was loose.
Of course, making the battery fit tighter would probably usually solve the problem, by wedging the switch hard enough to make contact even when bumped. But it's not the actual problem.
Even if that was the problem, I don't see the need for a magnet though; why not just stretch the spring a little, it'll make the battery tighter too.
The right thing to do is to try tightening the switch, see if that solves the problem. If not, then try the magnet thing I suppose, or just pull the spring a little longer.
__________________
Work: the 8 hours that separates bike rides.