{{ fact_h.value | jsonprint }}{% endfilter %}
- {%- else -%}
- {% filter jsonprint %}{{ fact_h.value }}{% endfilter %}
- {%- endif -%}
- {%- endif -%}
- ]
- {% endfor -%}
- ]
- {%- if render_graph %},
- "chart": [
- {% for fact_h in facts | map('format_attribute', 'value', '{0}') | groupby('value') -%}
- {%- if not loop.first %},{%- endif -%}
- {
- "label": {{ fact_h.grouper | replace("\n", " ") | jsonprint }},
- "value": {{ fact_h.list|length }}
- }
- {% endfor %}
- ]
- {% endif %}
-}
diff --git a/test/test_app.py b/test/test_app.py
index 79e4d1b..7a6acd6 100644
--- a/test/test_app.py
+++ b/test/test_app.py
@@ -727,7 +727,7 @@ def test_fact_json_with_graph(client, mocker,
assert 'chart' in result_json
assert len(result_json['chart']) == 5
# Test group_by
- assert result_json['chart'][3]['value'] == 2
+ assert result_json['chart'][0]['value'] == 2
def test_fact_json_without_graph(client, mocker,