Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicitne vytvorenie stavu timu na sifre #148

Open
michalmasrna1 opened this issue Oct 5, 2024 · 0 comments
Open

Duplicitne vytvorenie stavu timu na sifre #148

michalmasrna1 opened this issue Oct 5, 2024 · 0 comments

Comments

@michalmasrna1
Copy link
Contributor

michalmasrna1 commented Oct 5, 2024

Pocas kosa 2024 kod raz spadol na riadku 232 vo views.py vo funkcii get_context_data v GameView:
state = PuzzleTeamState.get_or_create(
team=team,
puzzle=puzzle
)
na tom, ze pre dany tim a puzzle existovali dva taketo stavy. Skutocne boli v databaze dva identicke, po vymazani jedneho z nich vsetko fungovalo vporiadku. Kedze sa to nestava casto (myslim ze prvykrat za 3 roky), moje podozrenie je, ze ide o nejaku zvlastnu race condition. Myslim, ze by malo stacit obalit volanie get_or_create do try except, resp. specifikovat, ako sa ma kod zachovat, ak by mali byt vratene dva objekty (pouzit iba ten s mensim id alebo podobne). Treba sa nad tym ale zamysliet na vsetkych miestach kde sa getuje PuzzleTeamState objekt, nie len tu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant