From b555b0e4945f0dc17f3f358159cd06ec26abadd3 Mon Sep 17 00:00:00 2001 From: panda-byte Date: Fri, 6 Oct 2023 00:14:59 +0200 Subject: [PATCH 1/4] Add `repeat_until_correct` setting to `Profile` model --- api/serializers.py | 1 + kw_webapp/models.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/api/serializers.py b/api/serializers.py index ef067d36..5c58de1d 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -191,6 +191,7 @@ class Meta: "info_detail_level_on_failure", "order_reviews_by_level", "burn_reviews", + "repeat_until_correct" ) read_only_fields = ( diff --git a/kw_webapp/models.py b/kw_webapp/models.py index c07289bf..def829e3 100644 --- a/kw_webapp/models.py +++ b/kw_webapp/models.py @@ -115,6 +115,9 @@ class Profile(models.Model): auto_advance_on_success_delay_milliseconds = models.PositiveIntegerField( default=1000 ) + + repeat_until_correct = models.BooleanField(default=False) + auto_expand_answer_on_success = models.BooleanField(default=True) auto_expand_answer_on_failure = models.BooleanField(default=False) info_detail_level_on_success = models.PositiveIntegerField( From 90db684816c26ff7ad82cafb52153b7c5b9a1838 Mon Sep 17 00:00:00 2001 From: panda-byte Date: Fri, 6 Oct 2023 00:15:18 +0200 Subject: [PATCH 2/4] Add test for `repeat_until_correct` setting --- kw_webapp/tests/serializers/test_profile_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kw_webapp/tests/serializers/test_profile_api.py b/kw_webapp/tests/serializers/test_profile_api.py index 3c38eb42..ebe845dd 100644 --- a/kw_webapp/tests/serializers/test_profile_api.py +++ b/kw_webapp/tests/serializers/test_profile_api.py @@ -54,6 +54,7 @@ def test_profile_contains_expected_fields(self): self.assertIsNotNone(data["show_kanji_svg_stroke_order"]) self.assertIsNotNone(data["show_kanji_svg_grid"]) self.assertIsNotNone(data["kanji_svg_draw_speed"]) + self.assertIsNotNone(data["repeat_until_correct"]) def test_updating_profile_triggers_srs_correctly(self): self.client.force_login(user=self.user) From 1d9e3be510627e80aac5ee35827d63a415b923e6 Mon Sep 17 00:00:00 2001 From: panda-byte Date: Fri, 6 Oct 2023 00:15:25 +0200 Subject: [PATCH 3/4] Add migration for `repeat_until_correct` setting --- .../0004_add_repeat_until_correct_setting.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 kw_webapp/migrations/0004_add_repeat_until_correct_setting.py diff --git a/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py b/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py new file mode 100644 index 00000000..1f6b2bc5 --- /dev/null +++ b/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.4 on 2020-09-04 04:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kw_webapp', '0003_vocabulary_manual_reading_whitelist'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='repeat_until_correct', + field=models.BooleanField(default=False), + ), + ] From 10e4dbbd0c061702c449c92a8a63204dceaa5ea2 Mon Sep 17 00:00:00 2001 From: panda-byte Date: Wed, 11 Oct 2023 23:04:48 +0200 Subject: [PATCH 4/4] Remove invalid comment --- kw_webapp/migrations/0004_add_repeat_until_correct_setting.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py b/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py index 1f6b2bc5..afb516da 100644 --- a/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py +++ b/kw_webapp/migrations/0004_add_repeat_until_correct_setting.py @@ -1,5 +1,3 @@ -# Generated by Django 2.2.4 on 2020-09-04 04:02 - from django.db import migrations, models