From 4f30f0e8ed6625c8f0308dd79955cdb097c0473f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Fri, 25 Jan 2019 03:34:01 +0100 Subject: [PATCH] officejs_support_request_ui: workaround when we don't have a SR in each state --- ...SupportRequest_getSupportRequestStatisticsAsJson.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py b/bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py index 4f3ad9cf0dc..80a4901b954 100644 --- a/bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py +++ b/bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py @@ -16,6 +16,7 @@ date_30_midnight = DateTime(now_date - timedelta(days=30)).earliestTime() # currently active support requests by state. Unless CRM agents are late # in the processing of these support requests, they should not be too many. count_by_state_and_date_range = defaultdict(lambda:defaultdict(int)) + for brain in portal.portal_catalog( portal_type="Support Request", simulation_state=("submitted", "suspended", "validated",), @@ -49,6 +50,14 @@ count_by_state_and_date_range = { for date_range in date_range_list ] } for state in count_by_state_and_date_range } +# XXX +state_title_by_state_id = portal.ERP5Site_getTicketWorkflowStateInfoDict() +for c in state_title_by_state_id.keys(): + if c not in count_by_state_and_date_range: + count_by_state_and_date_range[c] = { + "date_range_list": date_range_list, + "count_list": [0, 0, 0, 0], + } # Count last month activity by state # we only select support requests from last 30 days, so there should not be too many. @@ -66,3 +75,4 @@ return dumps({ "count_by_state_and_date_range": count_by_state_and_date_range, "state_title_by_state_id": portal.ERP5Site_getTicketWorkflowStateInfoDict() }) + -- 2.30.9