Skip to content

Commit

Permalink
refactor: LEAP-1322: Remove Stale Feature Flag - ff_back_2070_inner_i…
Browse files Browse the repository at this point in the history
…d_12052022_short
  • Loading branch information
luarmr committed Nov 27, 2024
1 parent 6ab4541 commit 6393324
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
1 change: 0 additions & 1 deletion label_studio/core/feature_flags/stale_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
'ff_front_dev_2431_delete_polygon_points_080622_short': True,
'ff_front_dev_2290_draft_in_annotation_history_short': True,
'ff_dev_2128_html_in_labels_150422_short': True,
'ff_back_2070_inner_id_12052022_short': True,
'ff_dev_2007_rework_choices_280322_short': True,
'ff_front_dev_1495_avatar_mess_210122_short': True,
'ff_front_1170_outliner_030222_short': True,
Expand Down
23 changes: 11 additions & 12 deletions label_studio/data_manager/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,17 @@ def get_all_columns(project, *_):
}
]

if flag_set('ff_back_2070_inner_id_12052022_short', user=project.organization.created_by):
result['columns'] += [
{
'id': 'inner_id',
'title': 'Inner ID',
'type': 'Number',
'help': 'Internal task ID starting from 1 for the current project',
'target': 'tasks',
'visibility_defaults': {'explore': False, 'labeling': False},
'project_defined': False,
}
]
result['columns'] += [
{
'id': 'inner_id',
'title': 'Inner ID',
'type': 'Number',
'help': 'Internal task ID starting from 1 for the current project',
'target': 'tasks',
'visibility_defaults': {'explore': False, 'labeling': False},
'project_defined': False,
}
]

if flag_set('fflag_fix_back_lsdv_4648_annotator_filter_29052023_short', user=project.organization.created_by):
project_members = project.all_members.values_list('id', flat=True)
Expand Down
22 changes: 10 additions & 12 deletions label_studio/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from data_import.models import FileUpload
from data_manager.managers import PreparedTaskManager, TaskManager
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.db import OperationalError, models, transaction
from django.db.models import CheckConstraint, JSONField, Q
from django.db.models.signals import post_delete, post_save, pre_delete, pre_save
Expand Down Expand Up @@ -517,17 +516,16 @@ def ensure_unique_groundtruth(self, annotation_id):
self.annotations.exclude(id=annotation_id).update(ground_truth=False)

def save(self, *args, update_fields=None, **kwargs):
if flag_set('ff_back_2070_inner_id_12052022_short', AnonymousUser):
if self.inner_id == 0:
task = Task.objects.filter(project=self.project).order_by('-inner_id').first()
max_inner_id = 1
if task:
max_inner_id = task.inner_id

# max_inner_id might be None in the old projects
self.inner_id = None if max_inner_id is None else (max_inner_id + 1)
if update_fields is not None:
update_fields = {'inner_id'}.union(update_fields)
if self.inner_id == 0:
task = Task.objects.filter(project=self.project).order_by('-inner_id').first()
max_inner_id = 1
if task:
max_inner_id = task.inner_id

# max_inner_id might be None in the old projects
self.inner_id = None if max_inner_id is None else (max_inner_id + 1)
if update_fields is not None:
update_fields = {'inner_id'}.union(update_fields)

super().save(*args, update_fields=update_fields, **kwargs)

Expand Down

0 comments on commit 6393324

Please sign in to comment.