diff --git a/server/Services/StatisticsService.cs b/server/Services/StatisticsService.cs index 93e1264..bcd5106 100644 --- a/server/Services/StatisticsService.cs +++ b/server/Services/StatisticsService.cs @@ -93,8 +93,9 @@ public async Task> CountCellEvents(ActionBody body) foreach(Cell cell in cells) { string wID = "WAREHOUSE/" + body.warehouseKey; + string cID = "CELL/" + cell._key; FormattableString filter1 = $"DATE_DIFF(x.dateAndTime, {body.end}, 's', true) > 0 AND DATE_DIFF({body.start}, x.dateAndTime, 's', true) > 0"; - FormattableString filter2 = $"AND x.action == {body.eventAction} AND x._from == {wID}"; + FormattableString filter2 = $"AND x.action == {body.eventAction} AND x._from == {wID} AND x._to == {cID}"; List events = await _arango.Query.FindAsync(_dbName, _eColName, $"{filter1} {filter2}"); diff --git a/server/test_data/events_list.json b/server/test_data/events_list.json index 10e6c59..7f7ca10 100644 --- a/server/test_data/events_list.json +++ b/server/test_data/events_list.json @@ -201,19 +201,19 @@ }, { "_key": "7478hdsjk-4tfr-74ff-56d9-gfh5563g6fr", - "_from": "WAREHOUSE/32cc7b3d-7f1c-4757-813c-182182e67753", - "_to": "CELL/4196faf0-20ad-4b90-a329-98b237ad5900", - "cellKey": "4196faf0-20ad-4b90-a329-98b237ad5900", + "_from": "WAREHOUSE/94708a72-73b4-4d68-804b-ed55f6a8dea1", + "_to": "CELL/aa183db1-825d-415d-b314-4e914f7e6b8a", + "cellKey": "aa183db1-825d-415d-b314-4e914f7e6b8a", "userKey": "e5ba8cfb-159d-4163-a212-2e2fcf5172c2", "action": "FIXED", - "dateAndTime": "2024-12-19T21:06:49.7187898+00:00", + "dateAndTime": "2024-09-19T21:06:49.7187898+00:00", "description": "the cell has been serviced" }, { "_key": "456ergs-456g-65ds-96d9-dtrh677hthj7r", - "_from": "WAREHOUSE/32cc7b3d-7f1c-4757-813c-182182e67753", - "_to": "CELL/014c9ead-c108-416f-94e4-9a35cf4d82a6", - "cellKey": "014c9ead-c108-416f-94e4-9a35cf4d82a6", + "_from": "WAREHOUSE/94708a72-73b4-4d68-804b-ed55f6a8dea1", + "_to": "CELL/aa183db1-825d-415d-b314-4e914f7e6b8a", + "cellKey": "aa183db1-825d-415d-b314-4e914f7e6b8a", "userKey": "e5ba8cfb-159d-4163-a212-2e2fcf5172c2", "action": "FIXED", "dateAndTime": "2024-10-19T21:06:49.7187898+00:00", @@ -221,22 +221,22 @@ }, { "_key": "rt5tfggd-bdj0-74ff-96d9-dfhd8476rt56", - "_from": "WAREHOUSE/32cc7b3d-7f1c-4757-813c-182182e67753", - "_to": "CELL/4196faf0-20ad-4b90-a329-98b237ad5900", - "cellKey": "85537633-8ffc-45b0-a897-87146a086f05", + "_from": "WAREHOUSE/94708a72-73b4-4d68-804b-ed55f6a8dea1", + "_to": "CELL/61067a02-d840-4366-9783-368dcf7ecbae", + "cellKey": "61067a02-d840-4366-9783-368dcf7ecbae", "userKey": "c1f66414-51bb-433f-8c78-5f236b217251", "action": "FIXED", - "dateAndTime": "2024-12-19T21:06:49.7187898+00:00", + "dateAndTime": "2023-12-19T21:06:49.7187898+00:00", "description": "the cell has been serviced" }, { "_key": "0953jgf51-bdj0-74ff-96d9-7jfdstrh5p9", - "_from": "WAREHOUSE/32cc7b3d-7f1c-4757-813c-182182e67753", - "_to": "CELL/4196faf0-20ad-4b90-a329-98b237ad5900", - "cellKey": "85537633-8ffc-45b0-a897-87146a086f05", + "_from": "WAREHOUSE/94708a72-73b4-4d68-804b-ed55f6a8dea1", + "_to": "CELL/0fe43b01-3c26-4b93-bf2b-043f69b89301", + "cellKey": "0fe43b01-3c26-4b93-bf2b-043f69b89301", "userKey": "fec80ae6-d7b4-4020-8ec0-55765dac0c3d", "action": "FIXED", - "dateAndTime": "2024-12-19T21:06:49.7187898+00:00", + "dateAndTime": "2020-12-19T21:06:49.7187898+00:00", "description": "the cell has been serviced" } ] \ No newline at end of file