Make #1 ranked versions with avg >= 8.0 heady
This commit is contained in:
parent
945c126f42
commit
296cc4d2e2
1 changed files with 4 additions and 2 deletions
|
|
@ -145,10 +145,12 @@ def read_performance(slug: str, session: Session = Depends(get_session)):
|
|||
|
||||
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
|
||||
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
|
||||
is_heady = percentile <= 0.2 # Top 20%
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue