Skip to content

Commit

Permalink
use IDs instead of models objects
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRaphael0000 committed Apr 1, 2019
1 parent 8225708 commit d792550
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions opensauceapp/game/Lobby.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def reset(self):
for player in list(self.players.values()):
player.leave()
self.history = []
self.sauces = self.fetch_sauces_from_settings()
self.sauces_id = self.fetch_sauces_from_settings()
self.goto_waiting_for_players()

def set_default_settings(self):
Expand Down Expand Up @@ -89,7 +89,7 @@ def fetch_sauces_from_settings(self):

for sauce in all_sauces:
if settings_lookup[(sauce.sauce_category.id, sauce.difficulty)]:
filtred_sauces.append(sauce)
filtred_sauces.append(sauce.id)

return filtred_sauces

Expand Down Expand Up @@ -185,7 +185,7 @@ def goto_question_state(self, first_round=False):
self.broadcast(self.get_scoreboard())

# Set new sauce
self.current_sauce = random.choice(self.sauces)
self.current_sauce = Sauce.objects.filter(id=random.choice(self.sauces_id))[0]
# Set a new state id, used for delayed thread
self.state_id = token_hex(16)
# Set the end time
Expand Down Expand Up @@ -314,7 +314,7 @@ def player_set_settings(self, secKey, settings):
if not player.isAdmin:
return
self.settings = settings
self.sauces = self.fetch_sauces_from_settings()
self.sauces_id = self.fetch_sauces_from_settings()
self.broadcast(self.get_settings())

# ____ _ _ ____ _
Expand Down

0 comments on commit d792550

Please sign in to comment.