fix reputation calculation

Add attempts after calculating rep and handle division by 0