Details are sparse. So, on the assumption this is talk of a rack in an house, I'd also guess that there is a carpet floor involved, too.
So it would work like this. Person shuffles along carpet and picks up a static charge (bunch of homeless ions milling about with no place to go). When said person touches the rack with a ratio of ions more or less than the person carrying the homeless, the person either collects or sheds ions, Zap! If the rack is already grounded, the charge drains away to earth which has lots of area for homeless ions to dance into the wee hours of the millennia. If the rack is insulated, it stores ions delivered by the shuffling person and the next person to come along who doesn't have the same ratio of ions either collects or sheds ions, zap.
Earth grounding the rack may help sometimes to lessen the zap. Or, it might increase the zap intensity. But, make certain that your damaged extension cord ONLY makes a connection to that third, earth ground wall outlet socket hole. You don't want 115v AC running around loose in the house, unless you want a MUCH more intense ZAP taking place.
Also, electrons can jump into the atmosphere and does so at an increased rate when more conductive particles are present in the air, such as water molecules (Humidity).
Probably the best way to reduce your zapping problem is to humidify the air in your house.
Or, replace your carpet with one that has embedded carbon fibers.
Cheers,