Skip to content

Commit

Permalink
Cleanup unwanted code
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Dec 9, 2024
1 parent 7f9579b commit 8eee12b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 0 additions & 2 deletions apps/deepl_integration/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,6 @@ def _process_model_preds(cls, model_version, draft_entry, model_prediction):
**common_attrs,
model_tags=tags
)
# draft_entry.prediction_status = DraftEntry.PredictionStatus.DONE
# draft_entry.save(update_fields='prediction_status')

@classmethod
@transaction.atomic
Expand Down
8 changes: 8 additions & 0 deletions apps/geo/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ def mutate(root, info, admin_level_id):
)
], ok=False)
admin_level.delete()
# check boundsfile is empty or not in Region
region = admin_level.region
if region.adminlevel_set.filter(bounds_file__isnull=True).count() == 0:
region.status = Region.Status.COMPLETED
region.save(update_fields=['status'])
return DeleteAdminLevel(errors=None, ok=True)
region.status = Region.Status.FAILED
region.save(update_fields=['status'])
return DeleteAdminLevel(errors=None, ok=True)


Expand Down
3 changes: 2 additions & 1 deletion apps/geo/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ def update(self, instance, validated_data):
validated_data,
)
region = admin_level.region
region.status = Region.Status.INITIATED
region.modified_by = self.context['request'].user
region.save(update_fields=('modified_by', 'modified_at',))
region.save(update_fields=('modified_by', 'modified_at', 'status'))

transaction.on_commit(lambda: load_geo_areas.delay(region.id))

Expand Down
11 changes: 9 additions & 2 deletions apps/lead/filter_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from project.models import Project
from organization.models import OrganizationType
from user.models import User
from entry.models import Entry
from entry.models import Entry, EntryAttachment
from entry.filter_set import EntryGQFilterSet, EntriesFilterDataInputType, EntriesFilterDataType
from user_resource.filters import UserResourceGqlFilterSet

Expand Down Expand Up @@ -576,8 +576,15 @@ def filter_exclude_lead_attachment_ids(self, qs, _, value):
return qs

def filter_exclude_leadattachment_created_entries(self, qs, _, value):
ids = qs.values_list('id', flat=True)
entry_attachment_qs = EntryAttachment.objects.filter(
lead_attachment__in=ids
).values_list('lead_attachment__id', flat=True).distinct()
entry_qs = Entry.objects.filter(
entry_attachment__in=entry_attachment_qs
).values_list('entry_attachment__id', flat=True).distinct()
if value:
qs = qs.exclude(lead__entry__isnull=value)
qs = qs.exclude(id__in=entry_qs)
return qs
return qs

Expand Down

0 comments on commit 8eee12b

Please sign in to comment.