fix: module issue updation and activity logging

This commit is contained in:
pablohashescobar 2023-02-07 14:05:09 +05:30
parent f09c9b67f6
commit 8801a291af

View File

@ -165,10 +165,10 @@ class ModuleIssueViewSet(BaseViewSet):
] ]
if len(module_issue): if len(module_issue):
if module_issue[0].cycle_id != module_id: if module_issue[0].module_id != module_id:
update_module_issue_activity.append( update_module_issue_activity.append(
{ {
"old_module_id": str(module_issue[0].cycle_id), "old_module_id": str(module_issue[0].module_id),
"new_module_id": str(module_id), "new_module_id": str(module_id),
"issue_id": str(module_issue[0].issue_id), "issue_id": str(module_issue[0].issue_id),
} }
@ -179,7 +179,7 @@ class ModuleIssueViewSet(BaseViewSet):
record_to_create.append( record_to_create.append(
ModuleIssue( ModuleIssue(
module=module, module=module,
issue_id=issue, issue=issue,
project_id=project_id, project_id=project_id,
workspace=module.workspace, workspace=module.workspace,
created_by=request.user, created_by=request.user,
@ -203,14 +203,14 @@ class ModuleIssueViewSet(BaseViewSet):
issue_activity.delay( issue_activity.delay(
{ {
"type": "issue.activity", "type": "issue.activity",
"requested_data": json.dumps({"cycles_list": issues}), "requested_data": json.dumps({"modules_list": issues}),
"actor_id": str(self.request.user.id), "actor_id": str(self.request.user.id),
"issue_id": str(self.kwargs.get("pk", None)), "issue_id": str(self.kwargs.get("pk", None)),
"project_id": str(self.kwargs.get("project_id", None)), "project_id": str(self.kwargs.get("project_id", None)),
"current_instance": json.dumps( "current_instance": json.dumps(
{ {
"updated_cycle_issues": update_module_issue_activity, "updated_module_issues": update_module_issue_activity,
"created_cycle_issues": serializers.serialize( "created_module_issues": serializers.serialize(
"json", record_to_create "json", record_to_create
), ),
} }