Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/plane/bgtasks/analytic_plot_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def generate_segmented_rows(

if segmented == MODULE_ID:
for index, segm in enumerate(row_zero[2:]):
module = next((mod for mod in label_details if str(mod[MODULE_ID]) == str(segm)), None)
module = next((mod for mod in module_details if str(mod[MODULE_ID]) == str(segm)), None)
if module:
row_zero[index + 2] = module["issue_module__module__name"]

Expand Down
41 changes: 41 additions & 0 deletions apps/api/plane/tests/unit/bg_tasks/test_analytic_plot_export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.

import pytest

from plane.bgtasks.analytic_plot_export import (
MODULE_ID,
generate_segmented_rows,
)


@pytest.mark.unit
class TestGenerateSegmentedRows:
def test_module_segment_headers_use_module_names(self):
rows = generate_segmented_rows(
distribution={
"High": [
{
"segment": "module-1",
"issue_count": 3,
}
]
},
x_axis="priority",
y_axis="issue_count",
segment=MODULE_ID,
key="issue_count",
assignee_details=[],
label_details=[],
state_details=[],
cycle_details=[],
module_details=[
{
MODULE_ID: "module-1",
"issue_module__module__name": "Launch Plan",
}
],
)

assert rows[0] == ("Priority", "Issue Count", "Launch Plan")