UiL-OTS-labs / web-experiment-datastore

Other
0 stars 0 forks source link

Default group not assigned to regular uploads #43

Closed tymees closed 2 years ago

tymees commented 2 years ago

I'm afraid we missed something in this PR. Experiments now have a default group, but ParticipantSession.group remained nullable. And ParticipantSessions are created without a target group in UploadView: https://github.com/UiL-OTS-labs/web-experiment-datastore/blob/0869a39b0e7c4163670d5c3667f23ba8fe30cfbb/api/views.py#L121

This is not too bad, but it means that the completion counter for the default group remains on 0

Originally posted by @bbonf in https://github.com/UiL-OTS-labs/web-experiment-datastore/issues/39#issuecomment-1042769738

maartenuni commented 2 years ago

I'm thinking out loud. Shall I Modify ParticipantSession.group in not nullable? Than, I think creating a group as on line 121 would become an error. So, I would have to look up a default group/the first group in the experiment and add this to:

ParticipantSession.objects.create(experiment=self.experiment, group=first_group)

And I check if no other ParticipantSession.object.create() is missing a group argument throughout the code?

tymees commented 2 years ago

Yes, that's basically it.

It'd be fine if you were to do it like this:

ParticipantSession.objects.create(
    experiment=self.experiment,
    group=self.experiment.targetgroup_set.first()
)