Skip to content

Commit f061b44

Browse files
authored
fix: DEV-3259: Support updated_by for Annotations - Revert (#3289)
* Revert "feat: DEV-3259: Support updated_by for Annotations (#3244)" This reverts commit 82b3c53. * add revert function
1 parent 78471c6 commit f061b44

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

label_studio/tasks/api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ def update(self, request, *args, **kwargs):
269269
# save user history with annotator_id, time & annotation result
270270
annotation_id = self.kwargs['pk']
271271
annotation = get_object_with_check_and_log(request, Annotation, pk=annotation_id)
272-
annotation.updated_by = request.user
273-
annotation.save(update_fields=['updated_by'])
274272

275273
task = annotation.task
276274
if self.request.data.get('ground_truth'):
@@ -386,7 +384,6 @@ def perform_create(self, ser):
386384
# serialize annotation
387385
extra_args.update({
388386
'prediction': prediction_ser,
389-
'updated_by': user
390387
})
391388

392389
if 'was_cancelled' in self.request.GET:

label_studio/tasks/migrations/0031_auto_20221118_2338.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ def set_updated_by(apps, _):
1111
obj.updated_by = obj.task.updated_by
1212
obj.save()
1313

14+
def revert(apps, _):
15+
pass
16+
1417
class Migration(migrations.Migration):
1518

1619
dependencies = [
@@ -24,5 +27,5 @@ class Migration(migrations.Migration):
2427
name='updated_by',
2528
field=models.ForeignKey(help_text='Last user who updated this annotation', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='updated_annotations', to=settings.AUTH_USER_MODEL, verbose_name='updated by'),
2629
),
27-
migrations.RunPython(set_updated_by)
30+
migrations.RunPython(set_updated_by, revert)
2831
]

label_studio/tasks/models.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ class Annotation(AnnotationMixin, models.Model):
362362
help_text='Project ID for this annotation')
363363
completed_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="annotations", on_delete=models.SET_NULL,
364364
null=True, help_text='User ID of the person who created this annotation')
365-
updated_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='updated_annotations',
366-
on_delete=models.SET_NULL, null=True, verbose_name=_('updated by'),
367-
help_text='Last user who updated this annotation')
368365
was_cancelled = models.BooleanField(_('was cancelled'), default=False, help_text='User skipped the task', db_index=True)
369366
ground_truth = models.BooleanField(_('ground_truth'), default=False, help_text='This annotation is a Ground Truth (ground_truth)', db_index=True)
370367
created_at = models.DateTimeField(_('created at'), auto_now_add=True, help_text='Creation time')
@@ -435,9 +432,6 @@ def update_task(self):
435432
self.task.save(update_fields=update_fields)
436433

437434
def save(self, *args, **kwargs):
438-
request = get_current_request()
439-
if request:
440-
self.updated_by = request.user
441435
result = super().save(*args, **kwargs)
442436
self.update_task()
443437
return result

label_studio/tests/test_annotations.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ def test_create_annotation(caplog, any_client, configured_project_min_annotation
4747
# annotator client
4848
if hasattr(any_client, 'annotator') and any_client.annotator is not None:
4949
assert annotation.completed_by.id == any_client.user.id
50-
assert annotation.updated_by.id == any_client.user.id
5150
# business client
5251
else:
5352
assert annotation.completed_by.id == any_client.business.admin.id
54-
assert annotation.updated_by.id == any_client.business.admin.id
5553

5654
if apps.is_installed('businesses'):
5755
assert annotation.task.accuracy == 1.0
@@ -95,9 +93,6 @@ def test_create_annotation_with_ground_truth(caplog, any_client, configured_proj
9593
assert m.called
9694
task = Task.objects.get(id=task.id)
9795
assert task.annotations.count() == 2
98-
annotations = Annotation.objects.filter(task=task)
99-
for a in annotations:
100-
assert a.updated_by.id == any_client.user.id
10196

10297

10398
@pytest.mark.django_db

0 commit comments

Comments
 (0)