Skip to content

Commit

Permalink
Fix Activity stat
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Sep 18, 2024
1 parent a9ae970 commit 1c2b917
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions fyle_accounting_mappings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,20 @@ def get(self, request, *args, **kwargs):
filters['source__active'] = True

mapped_attributes_count = Mapping.objects.filter(**filters).count()
activity_mapping = None

if source_type == 'CATEGORY':
activity_attribute_count = ExpenseAttribute.objects.filter(
attribute_type='CATEGORY', value='Activity', workspace_id=self.kwargs['workspace_id'], active=True).count()
activity_category_mapping = CategoryMapping.objects.filter(
source_category__value='Activity', workspace_id=self.kwargs['workspace_id']).first()
activity_mapping = Mapping.objects.filter(
source_type='CATEGORY', source___value='Activity', workspace_id=self.kwargs['workspace_id']).first()

if activity_attribute_count and not activity_category_mapping and not activity_mapping:

if app_name in ('NETSUITE', 'INTACCT','SAGE_300_CRE', 'DYNAMICS_365_BUSINESS_CENTRAL'):
activity_mapping = CategoryMapping.objects.filter(
source_category__value='Activity', workspace_id=self.kwargs['workspace_id']).first()
else:
activity_mapping = Mapping.objects.filter(
source_type='CATEGORY', source___value='Activity', workspace_id=self.kwargs['workspace_id']).first()

if activity_attribute_count and not activity_mapping:
mapped_attributes_count += activity_attribute_count

return Response(
Expand Down

0 comments on commit 1c2b917

Please sign in to comment.