mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-08 00:37:38 +08:00
Merge pull request #23 from Menci/use_b10_as_r10
Add USE_B10_AS_R10 option
This commit is contained in:
@@ -282,29 +282,37 @@ 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 x != []:
|
if not Config.USE_B10_AS_R10:
|
||||||
for i in x:
|
if x != []:
|
||||||
sumr += float(i[0])
|
for i in x:
|
||||||
c.execute('''select * from recent30 where user_id = :a''', {'a': user_id})
|
sumr += float(i[0])
|
||||||
x = c.fetchone()
|
c.execute('''select * from recent30 where user_id = :a''', {'a': user_id})
|
||||||
if x is not None:
|
x = c.fetchone()
|
||||||
r30 = []
|
if x is not None:
|
||||||
s30 = []
|
r30 = []
|
||||||
for i in range(1, 61, 2):
|
s30 = []
|
||||||
if x[i] is not None:
|
for i in range(1, 61, 2):
|
||||||
r30.append(float(x[i]))
|
if x[i] is not None:
|
||||||
s30.append(x[i+1])
|
r30.append(float(x[i]))
|
||||||
else:
|
s30.append(x[i+1])
|
||||||
r30.append(0)
|
else:
|
||||||
s30.append('')
|
r30.append(0)
|
||||||
r30, s30 = (list(t) for t in zip(*sorted(zip(r30, s30), reverse=True)))
|
s30.append('')
|
||||||
songs = []
|
r30, s30 = (list(t) for t in zip(*sorted(zip(r30, s30), reverse=True)))
|
||||||
i = 0
|
songs = []
|
||||||
while len(songs) < 10 and i <= 29 and s30[i] != '' and s30[i] is not None:
|
i = 0
|
||||||
if s30[i] not in songs:
|
while len(songs) < 10 and i <= 29 and s30[i] != '' and s30[i] is not None:
|
||||||
sumr += r30[i]
|
if s30[i] not in songs:
|
||||||
songs.append(s30[i])
|
sumr += r30[i]
|
||||||
i += 1
|
songs.append(s30[i])
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
'''
|
||||||
|
--------------------
|
||||||
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user