mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-21 15:00:18 +00:00
Compare commits
2 Commits
3867b273c7
...
c1f83eff55
Author | SHA1 | Date | |
---|---|---|---|
c1f83eff55 | |||
3349620b3a |
@ -259,6 +259,14 @@ class Database(metaclass=Singleton):
|
||||
result = session.scalar(stmt)
|
||||
return result
|
||||
|
||||
def get_score_best(self, song_id: str, rating_class: int):
|
||||
stmt = select(ScoreBest).where(
|
||||
(ScoreBest.song_id == song_id) & (ScoreBest.rating_class == rating_class)
|
||||
)
|
||||
with self.sessionmaker() as session:
|
||||
result = session.scalar(stmt)
|
||||
return result
|
||||
|
||||
def insert_score(self, score: Score):
|
||||
with self.sessionmaker() as session:
|
||||
session.add(score)
|
||||
@ -283,7 +291,7 @@ class Database(metaclass=Singleton):
|
||||
session.delete(score)
|
||||
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)
|
||||
|
||||
results = []
|
||||
@ -306,6 +314,8 @@ class Database(metaclass=Singleton):
|
||||
(ScoreBest.song_id == chart.song_id)
|
||||
& (ScoreBest.rating_class == chart.rating_class)
|
||||
& (ScoreBest.score >= min_score)
|
||||
& (play_result - bounds < ScoreBest.potential)
|
||||
& (ScoreBest.potential < play_result + bounds)
|
||||
)
|
||||
if session.scalar(score_best_stmt):
|
||||
chart_id = f"{chart.song_id},{chart.rating_class}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user