Commit 848c28eb authored by Boxiang Sun's avatar Boxiang Sun Committed by Tristan Cavelier

erp5_officejs_support_request_ui: Drop the SR which more than 30 days.

parent 2d47c86f
......@@ -153,12 +153,11 @@
data: [
{
value_dict: {
0: ["< 2", "2-7", "7-30", "> 30"],
0: ["< 2", "2-7", "7-30"],
1: [
sp_data.le2.validated,
sp_data['2to7'].validated,
sp_data['7to30'].validated,
sp_data.gt30.validated
sp_data['7to30'].validated
]
},
colors: ['#d48265'],
......@@ -167,12 +166,11 @@
},
{
value_dict: {
0: ["< 2", "2-7", "7-30", "> 30"],
0: ["< 2", "2-7", "7-30"],
1: [
sp_data.le2.submitted,
sp_data['2to7'].submitted,
sp_data['7to30'].submitted,
sp_data.gt30.submitted
sp_data['7to30'].submitted
]
},
colors: ['#61a0a8'],
......@@ -181,12 +179,11 @@
},
{
value_dict: {
0: ["< 2", "2-7", "7-30", "> 30"],
0: ["< 2", "2-7", "7-30"],
1: [
sp_data.le2.suspended,
sp_data['2to7'].suspended,
sp_data['7to30'].suspended,
sp_data.gt30.suspended
sp_data['7to30'].suspended
]
},
colors: ['#c23531'],
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.17232.34531.58794</string> </value>
<value> <string>962.23501.9134.29371</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1506095076.51</float>
<float>1506471192.27</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -2,11 +2,6 @@ from json import dumps
portal = context.getPortalObject()
support_request_list = portal.portal_catalog(portal_type="Support Request")
count_by_state = {}
count_by_date = {"le2": {}, "2to7": {}, "7to30": {}, "gt30": {}}
# Get the split date
now_date = DateTime()
date_2 = now_date - 2
......@@ -17,6 +12,13 @@ date_2_midnight = DateTime(str(date_2.year()) + "-" + str(date_2.month()) + "-"
date_7_midnight = DateTime(str(date_7.year()) + "-" + str(date_7.month()) + "-" + str(date_7.day()))
date_30_midnight = DateTime(str(date_30.year()) + "-" + str(date_30.month()) + "-" + str(date_30.day()))
support_request_list = portal.portal_catalog(
portal_type="Support Request",
modification_date={'query':date_30_midnight,'range':'nlt'}
)
count_by_state = {}
count_by_date = {"le2": {}, "2to7": {}, "7to30": {}}
for sr in support_request_list:
sr_date = sr.getModificationDate()
......@@ -33,13 +35,9 @@ for sr in support_request_list:
count_by_date["le2"][sr_state] = count_by_date["le2"][sr_state] + 1
elif sr_date >= date_7_midnight:
count_by_date["2to7"][sr_state] = count_by_date["2to7"][sr_state] + 1
elif sr_date >= date_30_midnight:
count_by_date["7to30"][sr_state] = count_by_date["7to30"][sr_state] + 1
else:
count_by_date["gt30"][sr_state] = count_by_date["gt30"][sr_state] + 1
if sr_date < date_30_midnight:
continue
count_by_date["7to30"][sr_state] = count_by_date["7to30"][sr_state] + 1
count_by_state[sr_state] = count_by_state[sr_state] + 1
result = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment