mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-22 07:20:18 +00:00
Compare commits
No commits in common. "c1f83eff55c28e07f418cde213c91d2b14fa61ec" and "3867b273c7373a6f74b44058b417612a838a3033" have entirely different histories.
c1f83eff55
...
3867b273c7
@ -259,14 +259,6 @@ class Database(metaclass=Singleton):
|
|||||||
result = session.scalar(stmt)
|
result = session.scalar(stmt)
|
||||||
return result
|
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):
|
def insert_score(self, score: Score):
|
||||||
with self.sessionmaker() as session:
|
with self.sessionmaker() as session:
|
||||||
session.add(score)
|
session.add(score)
|
||||||
@ -291,7 +283,7 @@ class Database(metaclass=Singleton):
|
|||||||
session.delete(score)
|
session.delete(score)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
def recommend_charts(self, play_result: float, bounds: float = 0.1):
|
def recommend_charts(self, play_result: float):
|
||||||
base_constant = math.ceil(play_result * 10)
|
base_constant = math.ceil(play_result * 10)
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
@ -314,8 +306,6 @@ 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