what I said in the last commit but correctly

This commit is contained in:
Anthony Samms
2025-11-07 16:29:11 -05:00
parent fc8dd75384
commit a48525e7b8
4 changed files with 6 additions and 2 deletions

View File

@@ -113,6 +113,7 @@ class SongBox:
continue continue
diff_hash = self.hash[diff] diff_hash = self.hash[diff]
self.scores[diff] = hash_to_score.get(diff_hash) self.scores[diff] = hash_to_score.get(diff_hash)
self.score_history = None
def move_box(self): def move_box(self):
if self.position != self.target_position and self.move is None: if self.position != self.target_position and self.move is None:

View File

@@ -1,6 +1,6 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import Any, TypedDict from typing import Any, Optional, TypedDict
class GeneralConfig(TypedDict): class GeneralConfig(TypedDict):
fps_counter: bool fps_counter: bool

View File

@@ -170,6 +170,7 @@ class GameScreen(Screen):
crown = 2 crown = 2
elif self.player_1.gauge.is_clear: elif self.player_1.gauge.is_clear:
crown = 1 crown = 1
logger.info(f"Existing score: {existing_score}, Existing crown: {existing_crown}, New score: {session_data.result_score}, New crown: {crown}")
if result is None or (existing_score is not None and session_data.result_score > existing_score): if result is None or (existing_score is not None and session_data.result_score > existing_score):
insert_query = ''' insert_query = '''
INSERT OR REPLACE INTO Scores (hash, en_name, jp_name, diff, score, good, ok, bad, drumroll, combo, clear) INSERT OR REPLACE INTO Scores (hash, en_name, jp_name, diff, score, good, ok, bad, drumroll, combo, clear)
@@ -181,6 +182,8 @@ class GameScreen(Screen):
session_data.result_ok, session_data.result_bad, session_data.result_ok, session_data.result_bad,
session_data.result_total_drumroll, session_data.result_max_combo, crown) session_data.result_total_drumroll, session_data.result_max_combo, crown)
cursor.execute(insert_query, data) cursor.execute(insert_query, data)
session_data.prev_score = existing_score if existing_score is not None else 0
logger.info(f"Wrote score {session_data.result_score} for {self.tja.metadata.title['en']}")
con.commit() con.commit()
if result is None or (existing_crown is not None and crown > existing_crown): if result is None or (existing_crown is not None and crown > existing_crown):
cursor.execute("UPDATE Scores SET crown = ? WHERE hash = ?", (crown, hash)) cursor.execute("UPDATE Scores SET crown = ? WHERE hash = ?", (crown, hash))

View File

@@ -466,7 +466,7 @@ class HighScoreIndicator:
class Gauge: class Gauge:
"""The gauge from the game screen, at 0.9x scale""" """The gauge from the game screen, at 0.9x scale"""
def __init__(self, player_num: str, gauge_length: int, is_2p: bool): def __init__(self, player_num: str, gauge_length: float, is_2p: bool):
self.is_2p = is_2p self.is_2p = is_2p
self.player_num = player_num self.player_num = player_num
self.difficulty = min(2, global_data.session_data[int(player_num)-1].selected_difficulty) self.difficulty = min(2, global_data.session_data[int(player_num)-1].selected_difficulty)