Commit 2a778a68 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui: Add begin date to the query when user click...

erp5_officejs_support_request_ui: Add begin date to the query when user click on "Last Month Activity"

The filter when the user click on the "Last Month Activity" chart filter Support Request only by status (Submitted / Open / Suspended / Closed). So on the table "Recent updates", all the support request with the chosen status appear. There is no filter by "Begin Date" for the last 30 days, which is no coherent with the "Last Month Activity". => It should appear only the support request with the chosen status with a begin date < D - 30 days
parent 0f1bff69
...@@ -60,17 +60,17 @@ ...@@ -60,17 +60,17 @@
.declareMethod('getSearchCriteria', function (name, seriesName) { .declareMethod('getSearchCriteria', function (name, seriesName) {
var search_criteria, cur_mid_night = new Date(), days_2 = new Date(), var search_criteria, cur_mid_night = new Date(), days_2 = new Date(),
days_7 = new Date(), days_30 = new Date(), begin_date, end_date; days_7 = new Date(), days_30 = new Date(), begin_date, end_date;
cur_mid_night.setHours(0, 0, 0, 0);
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
days_30.setDate(cur_mid_night.getDate() - 30);
days_30.setHours(0, 0, 0, 0);
if (seriesName !== 'Support Request') { if (seriesName !== 'Support Request') {
// Situation 1: Search Support Request with date. // Situation 1: Search Support Request with date.
cur_mid_night.setHours(0, 0, 0, 0);
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
days_2.setDate(cur_mid_night.getDate() - 2); days_2.setDate(cur_mid_night.getDate() - 2);
days_7.setDate(cur_mid_night.getDate() - 7); days_7.setDate(cur_mid_night.getDate() - 7);
days_30.setDate(cur_mid_night.getDate() - 30);
days_2.setHours(0, 0, 0, 0); days_2.setHours(0, 0, 0, 0);
days_7.setHours(0, 0, 0, 0); days_7.setHours(0, 0, 0, 0);
days_30.setHours(0, 0, 0, 0);
if (name === '< 2') { if (name === '< 2') {
begin_date = days_2; begin_date = days_2;
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
} }
search_criteria = '( translated_simulation_state_title: "' + seriesName + '" AND delivery.start_date: >= ' + begin_date.toISOString().slice(0, 10) + ' AND delivery.start_date: < ' + end_date.toISOString().slice(0, 10) + ' )'; search_criteria = '( translated_simulation_state_title: "' + seriesName + '" AND delivery.start_date: >= ' + begin_date.toISOString().slice(0, 10) + ' AND delivery.start_date: < ' + end_date.toISOString().slice(0, 10) + ' )';
} else { } else {
// Situation 2: Search Support Request without date. // Situation 2: Search Support Request by state with limit of 30 days.
search_criteria = '( translated_simulation_state_title: "' + name + '")'; search_criteria = '( translated_simulation_state_title: "' + name + '" AND delivery.start_date: >= ' + days_30.toISOString().slice(0, 10) + ' )';
} }
return search_criteria; return search_criteria;
}) })
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>984.48957.14599.64153</string> </value> <value> <string>985.27934.60177.32068</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1592917663.81</float> <float>1595449693.01</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -142,7 +142,7 @@ and compare real click with simulated clicks. ...@@ -142,7 +142,7 @@ and compare real click with simulated clicks.
<td>relative=top</td><td></td></tr> <td>relative=top</td><td></td></tr>
<tr><td>waitForText</td> <tr><td>waitForText</td>
<td>//h1[contains(text(), "Recent Updates")]</td> <td>//h1[contains(text(), "Recent Updates")]</td>
<td>Recent Updates (3)</td></tr> <!-- FIXME: this should be 2 here. 123dsfa is not "last month" --> <td>Recent Updates (2)</td></tr>
<tr><td>waitForText</td> <tr><td>waitForText</td>
<td>//h1[contains(text(), "Recent Updates")]/../..//td[1]/a</td> <td>//h1[contains(text(), "Recent Updates")]/../..//td[1]/a</td>
<td>Yesterday - RobotMaking - Submitted</td></tr> <td>Yesterday - RobotMaking - Submitted</td></tr>
...@@ -150,6 +150,9 @@ and compare real click with simulated clicks. ...@@ -150,6 +150,9 @@ and compare real click with simulated clicks.
<!-- reset filter is now enabled --> <!-- reset filter is now enabled -->
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Reset Filter" and not(@disabled)]</td><td></td></tr> <td>//input[@data-i18n="[value]Reset Filter" and not(@disabled)]</td><td></td></tr>
<tr><td>assertTextNotPresent</td>
<td>123dsfa</td>
<td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//input[@data-i18n="[value]Reset Filter"]</td><td></td></tr> <td>//input[@data-i18n="[value]Reset Filter"]</td><td></td></tr>
......
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