Keep the rank counter and average in the DB, not to query all ranks just for the calculation