Skip to content

Commit

Permalink
Merge pull request #329 from IUrreta/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
IUrreta authored Aug 4, 2024
2 parents c2e89c4 + 4dd0da3 commit 3234e74
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
9 changes: 5 additions & 4 deletions back/commands/fitParts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ async def execute(self):
info.insert(0, f"Succesfully fitted all teams with their latets designs")
info_json = json.dumps(info)
await self.send_message_to_client(info_json)
design_dict = car_analysis.get_parts_from_team(self.message["teamID"])
parts_stats = ["Parts stats fetched", car_analysis.get_unitvalue_from_parts(design_dict), car_analysis.get_all_parts_from_team(self.message["teamID"])]
data_json = json.dumps(parts_stats)
await self.send_message_to_client(data_json)
if self.message.get("teamID") is not None:
design_dict = car_analysis.get_parts_from_team(self.message["teamID"])
parts_stats = ["Parts stats fetched", car_analysis.get_unitvalue_from_parts(design_dict), car_analysis.get_all_parts_from_team(self.message["teamID"])]
data_json = json.dumps(parts_stats)
await self.send_message_to_client(data_json)
10 changes: 9 additions & 1 deletion back/scripts/car_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,15 @@ def fit_latest_designs_one_team(self, team_id, parts):
self.add_part_to_loadout(design, part, team_id, loadout, item)
print(f"Item {item} alredy existed, added to loadout {loadout} for team {team_id} and part {part}")
else:
print(f"Design {design} already fitted for team {team_id} and part {part}")
other_loadout = 1 if loadout == 2 else 2
fitted_item_other = self.cursor.execute(f"SELECT ItemID FROM Parts_CarLoadout WHERE TeamID = {team_id} AND PartType = {part} AND LoadoutID = {other_loadout}").fetchone()
fitted_item = self.cursor.execute(f"SELECT ItemID FROM Parts_CarLoadout WHERE TeamID = {team_id} AND PartType = {part} AND LoadoutID = {loadout}").fetchone()
if fitted_item_other is not None and fitted_item is not None and fitted_item[0] == fitted_item_other[0]:
item = self.create_new_item(design, part)
self.add_part_to_loadout(design, part, team_id, loadout, item)
print(f"Both loadouts had the same item, new item created for team {team_id} and part {part}, itemID: {item} added to loadout {loadout}")
else:
print(f"Design {design} already fitted for team {team_id} and part {part}")

self.conn.commit()

Expand Down
2 changes: 1 addition & 1 deletion launcher/version.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.16
2.1.17
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Database Editor F1 Manager",
"version": "2.1.16",
"version": "2.1.17",
"description": "A tool that will let you edit your save file from F1 Manager games",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 3234e74

Please sign in to comment.