diff --git a/neuvue_project/workspace/admin.py b/neuvue_project/workspace/admin.py index 1cfe29df..5d57756e 100644 --- a/neuvue_project/workspace/admin.py +++ b/neuvue_project/workspace/admin.py @@ -41,6 +41,7 @@ class NamespaceAdmin(admin.ModelAdmin): "number_of_tasks_users_can_self_assign", "max_number_of_pending_tasks_per_user", "track_selected_segments", + "decrement_priority" ] }, ), diff --git a/neuvue_project/workspace/migrations/0017_namespace_decrement_priority.py b/neuvue_project/workspace/migrations/0017_namespace_decrement_priority.py new file mode 100644 index 00000000..c3716956 --- /dev/null +++ b/neuvue_project/workspace/migrations/0017_namespace_decrement_priority.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.7 on 2023-01-16 22:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workspace', '0016_forcedchoicebuttongroup_number_of_selected_segments_expected'), + ] + + operations = [ + migrations.AddField( + model_name='namespace', + name='decrement_priority', + field=models.IntegerField(default=100, verbose_name='When skipped, decrement priority by'), + ), + ] diff --git a/neuvue_project/workspace/models.py b/neuvue_project/workspace/models.py index a59a4c8a..cb6e4480 100644 --- a/neuvue_project/workspace/models.py +++ b/neuvue_project/workspace/models.py @@ -135,6 +135,7 @@ class Namespace(models.Model): number_of_tasks_users_can_self_assign = models.IntegerField(default=10) max_number_of_pending_tasks_per_user = models.IntegerField(default=200) track_selected_segments = models.BooleanField(default=False) + decrement_priority = models.IntegerField(default=100, verbose_name="When skipped, decrement priority by") """Pull From Push To Novice""" novice_pull_from = models.CharField( diff --git a/neuvue_project/workspace/views/workspace.py b/neuvue_project/workspace/views/workspace.py index 4ac27073..f58c3d95 100644 --- a/neuvue_project/workspace/views/workspace.py +++ b/neuvue_project/workspace/views/workspace.py @@ -48,7 +48,7 @@ def get(self, request, namespace=None, **kwargs): "seg_id": "", "is_open": False, "tasks_available": True, - "skipable": True, + "skipable": True if namespace_obj.decrement_priority > 0 else False, "instructions": "", "display_name": namespace_obj.display_name, "submission_method": submission_method, @@ -291,10 +291,12 @@ def post(self, request, *args, **kwargs): metadata["skipped"] = 1 try: + new_priority = task_df["priority"] - namespace_obj.decrement_priority + if new_priority < 0: new_priority = 0 client.patch_task( task_df["_id"], duration=duration, - priority=task_df["priority"] - 100, + priority=new_priority, status="pending", metadata=metadata, ng_state=ng_state,