hotosm / galaxy-api

Backend to fetch data from Underpass
https://galaxy-api.hotosm.org/latest/redoc
GNU Affero General Public License v3.0
14 stars 5 forks source link

[BUG] Tasking Manager validation time too big #327

Open NicolasGrosjean opened 2 years ago

NicolasGrosjean commented 2 years ago

Describe the bug

The validation time of the tasking manager is too big.

I suppose, the time are aggregated without manage the fact a user validate several tasks at the same time.

To Reproduce

Execute /mapathon/detail with the following request body

{"fromTimestamp":"2022-09-15T08:00:00.000","toTimestamp":"2022-09-15T08:15:00.000","projectIds":[13503],"hashtags":[]}

Expected behavior

All time are lower than 7,200 (2 hours in seconds).

Screenshots

image

NicolasGrosjean commented 2 years ago

TODO list:

NicolasGrosjean commented 2 years ago

Example of SQL to reproduce issue after using #329

-- Copy values which are in reality in project 13503 and tasks 2, 3 and 47, done by another user
COPY public.task_history (id, project_id, task_id, action, action_text, action_date, user_id) FROM stdin;
22217985    1   169 LOCKED_FOR_VALIDATION   01:26:17.469080 2022-09-15 14:26:01.778760  360183
22217986    1   170 LOCKED_FOR_VALIDATION   01:26:17.487379 2022-09-15 14:26:01.804268  360183
22217994    1   171 LOCKED_FOR_VALIDATION   01:26:17.534701 2022-09-15 14:26:02.108510  360183
22218532    1   169 STATE_CHANGE    VALIDATED   2022-09-15 15:52:19.237511  360183
22218533    1   170 STATE_CHANGE    VALIDATED   2022-09-15 15:52:19.286513  360183
22218541    1   171 STATE_CHANGE    VALIDATED   2022-09-15 15:52:19.637390  360183
\.
kshitijrajsharma commented 2 years ago

Interesting issue ! Thank you for this detailed info on your issue ! @NicolasGrosjean I will also look deeply in to this , So that i can provide support ! cc : @ramyaragupathy