active record stat calculations added to companies controller