Posted: 04/09/2016 at 17:07
When you say they are rotten, has the flesh in the centre has turned brown, which is known as 'brown heart'? That is caused by a nutrient (Boron) deficiency. This is worse on alkaline soils and spraying with a dilute solution of Borax a few times during the growing season should fix it.
The other possibilites are slugs eating into them which lets in fungal spores and starts them rotting. Lack of water followed later by lots of water can cause them to split, again letting in fungal spores.