Skip to content

Commit

Permalink
Merge branch 'waitpage-no-consumer'
Browse files Browse the repository at this point in the history
  • Loading branch information
oTree-org committed Sep 12, 2017
2 parents d42b2e1 + 7d4c199 commit 5ed25a2
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 871 deletions.
6 changes: 3 additions & 3 deletions otree/channels/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def post_connect(self, app_name, player_id, page_index, session_pk):
page_index=page_index,
id_in_subsession=int(group_id_in_subsession),
session_id=session_pk,
fully_completed=True).exists()
).exists()
if ready:
self.send({'status': 'ready'})

Expand All @@ -123,12 +123,12 @@ def post_connect(self, session_pk, page_index, group_id_in_subsession):
page_index=page_index,
id_in_subsession=int(group_id_in_subsession),
session_id=session_pk,
fully_completed=True).exists()
).exists()
else: # subsession
ready = CompletedSubsessionWaitPage.objects.filter(
page_index=page_index,
session_id=session_pk,
fully_completed=True).exists()
).exists()
if ready:
self.send({'status': 'ready'})

Expand Down
5 changes: 4 additions & 1 deletion otree/db/idmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def use_cache():
class IdMapModel(idmap.models.IdMapModel):
class Meta:
abstract = True
# needs to be here for Participant and Session
use_strong_refs = True

# The ``get_cached_instance`` method is the canonical access point for
# idmap to retrieve objects for a particular model from the cache. If it
Expand Down Expand Up @@ -98,5 +100,6 @@ def _get_save_objects_model_instances():
def save_objects():
for instance in _get_save_objects_model_instances():
# if there are no changes on the instance, SaveTheChange will detect
# that very quickly and skip saving.
# that very quickly and skip saving. I tested and it made no difference
# if I test whether _changed_fields is empty.
instance.save()
2 changes: 2 additions & 0 deletions otree/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def __new__(mcs, name, bases, attrs):
app_label = get_app_label_from_import_path(module)
meta.app_label = app_label
meta.db_table = "{}_{}".format(app_label, name.lower())
# i think needs to be here even though it's set on base model,
# because meta is not inherited (but not tested this)
meta.use_strong_refs = True
attrs["Meta"] = meta

Expand Down
1 change: 1 addition & 0 deletions otree/management/commands/dyno1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .webandworkers import Command # noqa
1 change: 1 addition & 0 deletions otree/management/commands/dyno2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .timeoutworker import Command # noqa
366 changes: 0 additions & 366 deletions otree/migrations/0001_squashed_0017_auto_20170208_0103.py

This file was deleted.

20 changes: 0 additions & 20 deletions otree/migrations/0018_participant_payoff.py

This file was deleted.

17 changes: 0 additions & 17 deletions otree/migrations/0019_delete_expectedroomparticipant.py

This file was deleted.

19 changes: 0 additions & 19 deletions otree/migrations/0020_auto_20170507_0042.py

This file was deleted.

19 changes: 0 additions & 19 deletions otree/migrations/0021_auto_20170719_2320.py

This file was deleted.

This file was deleted.

40 changes: 0 additions & 40 deletions otree/migrations/0023_auto_20170813_1511.py

This file was deleted.

19 changes: 0 additions & 19 deletions otree/migrations/0024_auto_20170828_0419.py

This file was deleted.

Empty file removed otree/migrations/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions otree/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def views_module_for_player(player):
page_index=page_index,
app_name=player._meta.app_config.name,
player_pk=player.pk,
subsession_pk=player.subsession.pk,
session_pk=self.pk,
url=reverse(View.url_name(),
args=[participant.code, page_index]))
)
Expand Down
5 changes: 3 additions & 2 deletions otree/models_concrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Meta:
page_index = models.PositiveIntegerField()
session = models.ForeignKey('otree.Session')
id_in_subsession = models.PositiveIntegerField(default=0)
fully_completed = models.BooleanField(default=False)


class CompletedSubsessionWaitPage(models.Model):
Expand All @@ -49,7 +48,6 @@ class Meta:

page_index = models.PositiveIntegerField()
session = models.ForeignKey('otree.Session')
fully_completed = models.BooleanField(default=False)


class ParticipantToPlayerLookup(models.Model):
Expand All @@ -62,6 +60,9 @@ class Meta:
page_index = models.PositiveIntegerField()
app_name = models.CharField(max_length=300)
player_pk = models.PositiveIntegerField()
# can't store group_pk because group can change!
subsession_pk = models.PositiveIntegerField()
session_pk = models.PositiveIntegerField()
url = models.CharField(max_length=300)


Expand Down
Loading

0 comments on commit 5ed25a2

Please sign in to comment.