def map_score_model(self, replay): score_model = Score() score_model.beatmap_hash = replay.beatmap_hash score_model.player_name = replay.player_name score_model.number_300s = replay.number_300s score_model.number_100s = replay.number_100s score_model.number_50s = replay.number_50s score_model.gekis = replay.gekis score_model.katus = replay.katus score_model.misses = replay.misses score_model.score = replay.score score_model.max_combo = replay.max_combo score_model.is_perfect_combo = replay.is_perfect_combo score_model.no_fail = Mod.NoFail in replay.mod_combination score_model.easy = Mod.Easy in replay.mod_combination score_model.hidden = Mod.Hidden in replay.mod_combination score_model.hard_rock = Mod.HardRock in replay.mod_combination score_model.sudden_death = Mod.SuddenDeath in replay.mod_combination score_model.double_time = Mod.DoubleTime in replay.mod_combination or Mod.Nightcore in replay.mod_combination score_model.relax = Mod.Relax in replay.mod_combination score_model.half_time = Mod.HalfTime in replay.mod_combination score_model.flashlight = Mod.Flashlight in replay.mod_combination score_model.spun_out = Mod.SpunOut in replay.mod_combination score_model.auto_pilot = Mod.Autopilot in replay.mod_combination score_model.perfect = Mod.Perfect in replay.mod_combination return score_model
def map_score_query_result(self, query_result): scores = [] for row in query_result: score = Score() score.id = int(row[0]) score.beatmap_hash = row[1] score.player_name = row[2] score.number_300s = int(row[3]) score.number_100s = int(row[4]) score.number_50s = int(row[5]) score.gekis = int(row[6]) score.katus = int(row[7]) score.misses = int(row[8]) score.score = int(row[9]) score.max_combo = int(row[10]) score.is_perfect_combo = bool(row[11]) score.no_fail = bool(row[12]) score.easy = bool(row[13]) score.hidden = bool(row[14]) score.hard_rock = bool(row[15]) score.sudden_death = bool(row[16]) score.double_time = bool(row[17]) score.relax = bool(row[18]) score.half_time = bool(row[19]) score.flashlight = bool(row[20]) score.spun_out = bool(row[21]) score.auto_pilot = bool(row[22]) score.perfect = bool(row[23]) score.pp = float(row[24]) score.beatmap_id = int(row[25]) score.profile_id = int(row[26]) score.accuracy = float(row[27]) scores.append(score) return scores