Merge branch 'develop' into disable_update_notification

This commit is contained in:
Suraj Shetty 2021-11-30 08:50:58 +05:30 committed by GitHub
commit ae420cc7e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View file

@ -42,16 +42,13 @@ def flush_old_route_records():
@frappe.whitelist()
def deferred_insert(routes):
routes_record = []
if isinstance(routes, str):
routes = json.loads(routes)
for route_doc in routes:
routes_record.append({
routes = [
{
"user": frappe.session.user,
"route": route_doc.get("route"),
"creation": route_doc.get("creation")
})
"route": route.get("route"),
"creation": route.get("creation"),
}
for route in frappe.parse_json(routes)
]
_deferred_insert("Route History", json.dumps(routes_record))
_deferred_insert("Route History", json.dumps(routes))

View file

@ -4,10 +4,10 @@ const routes_to_skip = ['Form', 'social', 'setup-wizard', 'recorder'];
const save_routes = frappe.utils.debounce(() => {
if (frappe.session.user === 'Guest') return;
const routes = frappe.route_history_queue;
frappe.route_history_queue = [];
if (!routes.length) return;
frappe.route_history_queue = [];
frappe.xcall('frappe.desk.doctype.route_history.route_history.deferred_insert', {
'routes': routes
}).catch(() => {