#1 by Phoebe (edited )
This question may be simple, but I just don't know how to do it...since I have already used the group_by_arrival_time in the first app, and the grouping will be messed up in the second app... Checking other discussions, I have added the following to the first app: def before_next_page(self): group_id=self.group.id_in_subsession self.participant.vars['group_id']=group_id And second app: def group_by_arrival_time_methods(self,waiting_players): group_id=self.participant.vars['group_id'] But I don't know how to make the grouping in the second app has the same ID as first app?
#2 by ccrabbe
Hi Phoebe - I would do this by getting the first app's group_matrix at the end with subsession.get_group_matrix() and then setting it at the beginning of the second app with subsession.set_group_matrix(): https://otree.readthedocs.io/en/latest/multiplayer/groups.html#get-group-matrix The tricky thing for you is that you won't be doing this in creating_session, so you'll need to find a place in your second app's execution at the very start before anybody starts. You might be able to do this inside your second app's group_by_arrival_time_method, or you might just be able to use a WaitPage with wait_for_all_groups=True and an after_all_players_arrive method. https://otree.readthedocs.io/en/latest/multiplayer/waitpages.html#after-all-players-arrive Thanks, --Chris
#3 by Phoebe
Hi Chris, Thank you so much for your reply! I have tried your methods, but still I am not sure how to pass the matrix from the first app to the second app? I have tried: for player in subsession.get_players(): matrix = subsession.get_group_matrix() players = subsession.get_players() for p in players: p.participant.vars['matrix']=matrix under subsession class. And on the second app I tried: class Subsession(BaseSubsession): def group_by_arrival_time_methods(self,waiting_players): matrix=self.participant.vars['matrix'] self.set_group_matrix(matrix) However, it seems not working, although no error messages. Is there a simpler way to fix it, perhaps...? Thank you so much for your help! Phoebe