Merge pull request #23 from Menci/use_b10_as_r10

Add USE_B10_AS_R10 option
This commit is contained in:
Lost-MSth
2021-06-17 12:53:33 +08:00
committed by GitHub
2 changed files with 41 additions and 23 deletions

View File

@@ -282,6 +282,7 @@ def get_user_ptt_float(c, user_id) -> float:
c.execute('''select rating from best_score where user_id = :a order by rating DESC limit 30''', { c.execute('''select rating from best_score where user_id = :a order by rating DESC limit 30''', {
'a': user_id}) 'a': user_id})
x = c.fetchall() x = c.fetchall()
if not Config.USE_B10_AS_R10:
if x != []: if x != []:
for i in x: for i in x:
sumr += float(i[0]) sumr += float(i[0])
@@ -305,6 +306,13 @@ def get_user_ptt_float(c, user_id) -> float:
sumr += r30[i] sumr += r30[i]
songs.append(s30[i]) songs.append(s30[i])
i += 1 i += 1
else:
if x != []:
for i in range(len(x)):
t = float(x[i][0])
sumr += t
if i < 10:
sumr += t
return sumr/40 return sumr/40

View File

@@ -201,3 +201,13 @@ class Config():
''' '''
-------------------- --------------------
''' '''
'''
--------------------
是否使用最好的 10 条记录(而不是最近的 30 条记录中较好的 10 条)来计算 PTT
Calculate PTT with best 10 instead of recent best 10
'''
USE_B10_AS_R10 = False
'''
--------------------
'''