ratings logic