Make #1 ranked versions with avg >= 8.0 heady

This commit is contained in:
fullsizemalt 2025-12-26 21:37:39 -08:00
parent 945c126f42
commit 296cc4d2e2

View file

@ -145,10 +145,12 @@ def read_performance(slug: str, session: Session = Depends(get_session)):
total_versions = len(all_perfs_data) total_versions = len(all_perfs_data)
# Heady = top 20% with at least 1 rating and avg >= 8.0 # Heady = #1 ranked with avg >= 8.0 OR top 20% with at least 1 rating and avg >= 8.0
is_heady = False is_heady = False
if current_rating_count > 0 and current_avg >= 8.0: if current_rating_count > 0 and current_avg >= 8.0:
if rank and total_versions > 0: if rank == 1: # Top ranked version always heady if avg >= 8.0
is_heady = True
elif rank and total_versions > 0:
percentile = rank / total_versions percentile = rank / total_versions
is_heady = percentile <= 0.2 # Top 20% is_heady = percentile <= 0.2 # Top 20%