forked from github/plane
fix: analytics segmented export (#1068)
* fix: analytics segmented export * dev: fix none type * fix: analytic export y axis count
This commit is contained in:
parent
d41250c1ce
commit
c3d520aefd
@ -65,20 +65,22 @@ def analytic_export_task(email, data, slug):
|
|||||||
]
|
]
|
||||||
+ segment_zero
|
+ segment_zero
|
||||||
)
|
)
|
||||||
|
|
||||||
rows = []
|
rows = []
|
||||||
for item in distribution:
|
for item in distribution:
|
||||||
generated_row = [
|
generated_row = [
|
||||||
item,
|
item,
|
||||||
]
|
]
|
||||||
|
|
||||||
data = distribution.get(item)
|
data = distribution.get(item)
|
||||||
for segment in segment_zero[1:]:
|
# Add y axis values
|
||||||
|
generated_row.append(sum(obj.get(key) for obj in data if obj.get(key, None) is not None))
|
||||||
|
|
||||||
|
for segment in segment_zero:
|
||||||
value = [x for x in data if x.get("segment") == segment]
|
value = [x for x in data if x.get("segment") == segment]
|
||||||
if len(value):
|
if len(value):
|
||||||
generated_row.append(value[0].get(key))
|
generated_row.append(value[0].get(key))
|
||||||
else:
|
else:
|
||||||
generated_row.append("0")
|
generated_row.append("0")
|
||||||
|
|
||||||
rows.append(tuple(generated_row))
|
rows.append(tuple(generated_row))
|
||||||
|
|
||||||
rows = [tuple(row_zero)] + rows
|
rows = [tuple(row_zero)] + rows
|
||||||
@ -114,7 +116,7 @@ def analytic_export_task(email, data, slug):
|
|||||||
item,
|
item,
|
||||||
distribution.get(item)[0].get("count")
|
distribution.get(item)[0].get("count")
|
||||||
if y_axis == "issue_count"
|
if y_axis == "issue_count"
|
||||||
else distribution.get(item)[0].get("estimate"),
|
else distribution.get(item)[0].get("estimate "),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user