fix: fix rebase issue
This commit is contained in:
parent
c84321d638
commit
4e83e7ccbb
1 changed files with 23 additions and 9 deletions
|
|
@ -30,15 +30,29 @@ def cache_source(function):
|
|||
return wrapper
|
||||
|
||||
def generate_and_cache_results(args, function, cache_key):
|
||||
args = frappe._dict(args)
|
||||
results = function(
|
||||
chart_name = args.chart_name,
|
||||
filters = args.filters or None,
|
||||
from_date = args.from_date or None,
|
||||
to_date = args.to_date or None,
|
||||
time_interval = args.time_interval or None,
|
||||
timespan = args.timespan or None,
|
||||
)
|
||||
try:
|
||||
args = frappe._dict(args)
|
||||
results = function(
|
||||
chart_name = args.chart_name,
|
||||
filters = args.filters or None,
|
||||
from_date = args.from_date or None,
|
||||
to_date = args.to_date or None,
|
||||
time_interval = args.time_interval or None,
|
||||
timespan = args.timespan or None,
|
||||
)
|
||||
except TypeError as e:
|
||||
if e.message == "'NoneType' object is not iterable":
|
||||
# Probably because of invalid link filter
|
||||
#
|
||||
# Note: Do not try to find the right way of doing this because
|
||||
# it results in an inelegant & inefficient solution
|
||||
# ref: https://github.com/frappe/frappe/pull/9403
|
||||
frappe.throw(_('Please check the filter values set for Dashboard Chart: {}').format(
|
||||
get_link_to_form(chart.doctype, chart.name)), title=_('Invalid Filter Value'))
|
||||
return
|
||||
else:
|
||||
raise
|
||||
|
||||
frappe.cache().set_value(cache_key, json.dumps(results, default=str))
|
||||
frappe.db.set_value("Dashboard Chart", args.chart_name, "last_synced_on", frappe.utils.now(), update_modified = False)
|
||||
return results
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue