fix: tracking new cycles and modules in activities

This commit is contained in:
pablohashescobar 2023-02-06 19:25:11 +05:30
parent 67a1052b7b
commit a576a2ab59

View File

@ -536,10 +536,13 @@ def track_cycles(
) )
for created_record in created_records: for created_record in created_records:
cycle = Cycle.objects.filter(pk=created_record.cycle_id).first() cycle = Cycle.objects.filter(
pk=created_record.get("fields").get("cycle")
).first()
issue_activities.append( issue_activities.append(
IssueActivity( IssueActivity(
issue_id=created_record.issue_id, issue_id=created_record.get("fields").get("issue"),
actor=actor, actor=actor,
verb="created", verb="created",
old_value="", old_value="",
@ -548,7 +551,6 @@ def track_cycles(
project=project, project=project,
workspace=project.workspace, workspace=project.workspace,
comment=f"{actor.email} added cycle {cycle.name}", comment=f"{actor.email} added cycle {cycle.name}",
old_identifier="",
new_identifier=cycle.id, new_identifier=cycle.id,
) )
) )
@ -591,10 +593,12 @@ def track_modules(
) )
for created_record in created_records: for created_record in created_records:
module = Module.objects.filter(pk=created_record.module_id).first() module = Module.objects.filter(
pk=created_record.get("fields").get("module")
).first()
issue_activities.append( issue_activities.append(
IssueActivity( IssueActivity(
issue_id=created_record.issue_id, issue_id=created_record.get("fields").get("issue"),
actor=actor, actor=actor,
verb="created", verb="created",
old_value="", old_value="",
@ -603,7 +607,6 @@ def track_modules(
project=project, project=project,
workspace=project.workspace, workspace=project.workspace,
comment=f"{actor.email} added module {module.name}", comment=f"{actor.email} added module {module.name}",
old_identifier="",
new_identifier=module.id, new_identifier=module.id,
) )
) )