-
Notifications
You must be signed in to change notification settings - Fork 1
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
Questions in database #946
Merged
Merged
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1240cc9
Add Question model
albertas-jn 3363c21
Update tests for Question model
albertas-jn 28bcfad
Fix linter errors
albertas-jn fd8a6c9
Fix linter errors 2
albertas-jn 07f0199
Fix linter errors 3
albertas-jn ce73f21
Merge develop
albertas-jn 9805400
Fix migration conflicts
albertas-jn 0455b1e
Modify button text, Add rules' default and save
albertas-jn 8074536
Do not add default questions to experiment if question_series does no…
albertas-jn 0b96862
Move question to own app
albertas-jn ce1ba2d
Merge develop
albertas-jn dc264c8
First createquestions then boostrap, add default question series to b…
albertas-jn 8ff247a
Convert indentation to spaces in experiment_admin.js and questionseri…
albertas-jn 65375bf
Randomize MSI_F3 questions in rhythm_battery_final.py (former gold_ms…
albertas-jn a52f9f2
Add tests for createquestions command
albertas-jn 0fc8474
Cleanup: remove get_default_question_keys()
albertas-jn 64d1692
Add docstrings to question app
albertas-jn a323cfe
Move createquestions command tests to question app
albertas-jn 3dc7bda
Merge develop
albertas-jn 64f08fc
Move create_default_questions() to bootstrap.py
albertas-jn 529810b
Data migration: add default questions to experiment only if rules exist
albertas-jn 89b0b33
Remove call_command() from test_createquestions()
albertas-jn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[ | ||
{ | ||
"model": "experiment.question", | ||
"pk": "dgf_generation", | ||
"fields": { | ||
"question": "When were you born?", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "dgf_gender_identity", | ||
"fields": { | ||
"question": "With which gender do you currently most identify?", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "P01_1", | ||
"fields": { | ||
"question": "Can you clap in time with a musical beat?", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "P01_2", | ||
"fields": { | ||
"question": "I can tap my foot in time with the beat of the music I hear.", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "P01_3", | ||
"fields": { | ||
"question": "When listening to music, can you move in time with the beat?", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "msi_01_music_activities", | ||
"fields": { | ||
"question": "I spend a lot of my free time doing music-related activities.", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "msi_03_writing", | ||
"fields": { | ||
"question": "I enjoy writing about music, for example on blogs and forums.", | ||
"editable": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.question", | ||
"pk": "msi_08_intrigued_styles", | ||
"fields": { | ||
"question": "I’m intrigued by musical styles I’m not familiar with and want to find out more.", | ||
"editable": false | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 1, | ||
"fields": { | ||
"question_series": 1, | ||
"question": "msi_01_music_activities", | ||
"index": 1 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 2, | ||
"fields": { | ||
"question_series": 1, | ||
"question": "msi_03_writing", | ||
"index": 2 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 3, | ||
"fields": { | ||
"question_series": 1, | ||
"question": "msi_08_intrigued_styles", | ||
"index": 3 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 4, | ||
"fields": { | ||
"question_series": 2, | ||
"question": "dgf_generation", | ||
"index": 1 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 5, | ||
"fields": { | ||
"question_series": 2, | ||
"question": "dgf_gender_identity", | ||
"index": 2 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 6, | ||
"fields": { | ||
"question_series": 2, | ||
"question": "P01_1", | ||
"index": 3 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 7, | ||
"fields": { | ||
"question_series": 2, | ||
"question": "P01_2", | ||
"index": 4 | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questioninseries", | ||
"pk": 8, | ||
"fields": { | ||
"question_series": 2, | ||
"question": "P01_3", | ||
"index": 5 | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"model": "experiment.questionseries", | ||
"pk": 1, | ||
"fields": { | ||
"experiment": 14, | ||
"index": 1, | ||
"randomize": false | ||
} | ||
}, | ||
{ | ||
"model": "experiment.questionseries", | ||
"pk": 2, | ||
"fields": { | ||
"experiment": 20, | ||
"index": 1, | ||
"randomize": false | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from experiment.questions import create_default_questions | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Creates default questions and question groups in the database" | ||
|
||
def handle(self, *args, **options): | ||
create_default_questions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Generated by Django 3.2.25 on 2024-04-16 11:06 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('experiment', '0033_rename_related'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Question', | ||
fields=[ | ||
('key', models.CharField(max_length=128, primary_key=True, serialize=False)), | ||
('question', models.CharField(max_length=1024)), | ||
('editable', models.BooleanField(default=True, editable=False)), | ||
], | ||
options={ | ||
'ordering': ['key'], | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='QuestionInSeries', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('index', models.PositiveIntegerField()), | ||
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='experiment.question')), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Question In Series objects', | ||
'ordering': ['index'], | ||
}, | ||
), | ||
migrations.RemoveField( | ||
model_name='experiment', | ||
name='questions', | ||
), | ||
migrations.CreateModel( | ||
name='QuestionSeries', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(default='', max_length=128)), | ||
('index', models.PositiveIntegerField()), | ||
('randomize', models.BooleanField(default=False)), | ||
('experiment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='experiment.experiment')), | ||
('questions', models.ManyToManyField(through='experiment.QuestionInSeries', to='experiment.Question')), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Question Series', | ||
'ordering': ['index'], | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='questioninseries', | ||
name='question_series', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='experiment.questionseries'), | ||
), | ||
migrations.CreateModel( | ||
name='QuestionGroup', | ||
fields=[ | ||
('key', models.CharField(max_length=128, primary_key=True, serialize=False)), | ||
('editable', models.BooleanField(default=True, editable=False)), | ||
('questions', models.ManyToManyField(to='experiment.Question')), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Question Groups', | ||
'ordering': ['key'], | ||
}, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='questioninseries', | ||
unique_together={('question_series', 'question')}, | ||
), | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a situation where you would want to run the
bootstrap
command and not thecreatequestions
command, or vice versa? If the answer is "no", it would be nicer to not have to call this extra command from the docker startup, and rather include this utility inbootstrap.py
.