Skip to content

Commit e931f3a

Browse files
final code done
1 parent 743e022 commit e931f3a

8 files changed

Lines changed: 467 additions & 43 deletions

File tree

backend/anudesh_backend/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
if DEBUG:
3838
ALLOWED_HOSTS = ["127.0.0.1", "localhost", "0.0.0.0", "*"]
3939
else:
40-
ALLOWED_HOSTS = ["127.0.0.1", "localhost",
40+
ALLOWED_HOSTS = [
4141
"dev.anudesh.ai4bharat.org",
4242
"0.0.0.0",
4343
"backend.dev.anudesh.ai4bharat.org",

backend/dataset/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# import resource
1+
import resource
22
from django.contrib import admin
33
from import_export.admin import ImportExportActionModelAdmin
44
from .resources import *

backend/organizations/tasks.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def send_user_reports_mail_org(
325325
start_date=None,
326326
end_date=None,
327327
period=None,
328+
workspace_ids=None,
328329
):
329330
"""Function to generate CSV of organization user reports and send mail to the owner/admin
330331
@@ -340,8 +341,13 @@ def send_user_reports_mail_org(
340341

341342
user = User.objects.get(id=user_id)
342343
organization = Organization.objects.get(pk=org_id)
344+
345+
if not workspace_ids:
346+
print("❌ No workspace IDs provided, exiting task")
347+
return
348+
343349
proj_objs = Project.objects.filter(
344-
organization_id=org_id, project_type=project_type
350+
organization_id=org_id, project_type=project_type,workspace_id__in=workspace_ids,
345351
)
346352

347353
if period:
@@ -825,6 +831,7 @@ def send_project_analytics_mail_org(
825831
user_id,
826832
sort_by_column_name,
827833
descending_order,
834+
workspace_ids
828835
):
829836
organization = Organization.objects.get(pk=org_id)
830837
user = User.objects.get(id=user_id)
@@ -834,18 +841,22 @@ def send_project_analytics_mail_org(
834841

835842
if descending_order == None:
836843
descending_order = False
837-
844+
845+
if not workspace_ids:
846+
print("❌ No workspace IDs provided, exiting task")
847+
return
848+
838849
if tgt_language == None:
839850
selected_language = "-"
840851
projects_obj = Project.objects.filter(
841-
organization_id=org_id, project_type=project_type
852+
organization_id=org_id, project_type=project_type,workspace_id__in=workspace_ids
842853
)
843854
else:
844855
selected_language = tgt_language
845856
projects_obj = Project.objects.filter(
846857
organization_id=org_id,
847858
tgt_language=tgt_language,
848-
project_type=project_type,
859+
project_type=project_type,workspace_id__in=workspace_ids
849860
)
850861
final_result = []
851862
if projects_obj.count() != 0:

0 commit comments

Comments
 (0)