fix(dashboards): Map Chart Type Average to aggregate function AVG (#8006)
Co-authored-by: adityahase <aditya@adityahase.com>
This commit is contained in:
parent
d9038e3b83
commit
02e2d17d71
1 changed files with 8 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ def get(chart_name, from_date=None, to_date=None, refresh = None):
|
|||
'''.format(
|
||||
unit_function = get_unit_function(chart.based_on, timegrain),
|
||||
datefield = chart.based_on,
|
||||
aggregate_function = chart.chart_type,
|
||||
aggregate_function = get_aggregate_function(chart.chart_type),
|
||||
value_field = chart.value_based_on or '1',
|
||||
doctype = chart.document_type,
|
||||
conditions = conditions,
|
||||
|
|
@ -67,6 +67,13 @@ def get(chart_name, from_date=None, to_date=None, refresh = None):
|
|||
}]
|
||||
}
|
||||
|
||||
def get_aggregate_function(chart_type):
|
||||
return {
|
||||
"Sum": "SUM",
|
||||
"Count": "COUNT",
|
||||
"Average": "AVG"
|
||||
}[chart_type]
|
||||
|
||||
def convert_to_dates(data, timegrain):
|
||||
result = []
|
||||
for d in data:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue