mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-17 21:30:18 +00:00
impr(db): better recommend_charts
This commit is contained in:
parent
3867b273c7
commit
3349620b3a
@ -283,7 +283,7 @@ class Database(metaclass=Singleton):
|
|||||||
session.delete(score)
|
session.delete(score)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
def recommend_charts(self, play_result: float):
|
def recommend_charts(self, play_result: float, bounds: float = 0.1):
|
||||||
base_constant = math.ceil(play_result * 10)
|
base_constant = math.ceil(play_result * 10)
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
@ -306,6 +306,8 @@ class Database(metaclass=Singleton):
|
|||||||
(ScoreBest.song_id == chart.song_id)
|
(ScoreBest.song_id == chart.song_id)
|
||||||
& (ScoreBest.rating_class == chart.rating_class)
|
& (ScoreBest.rating_class == chart.rating_class)
|
||||||
& (ScoreBest.score >= min_score)
|
& (ScoreBest.score >= min_score)
|
||||||
|
& (play_result - bounds < ScoreBest.potential)
|
||||||
|
& (ScoreBest.potential < play_result + bounds)
|
||||||
)
|
)
|
||||||
if session.scalar(score_best_stmt):
|
if session.scalar(score_best_stmt):
|
||||||
chart_id = f"{chart.song_id},{chart.rating_class}"
|
chart_id = f"{chart.song_id},{chart.rating_class}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user