phpreport
phpreport copied to clipboard
Task creation request sent twice
I've detected that sometimes an error is reported when saving tasks, but there's no apparent error. If you reload the page, you can see that the tasks had actually been saved.
Investigating the issue, I checked the network inspector and I saw two calls to createTaskService, both contained the same data:
<?xml version="1.0" encoding="UTF-8"?><tasks><task><date>2019-01-23</date><initTime>17:45</initTime><endTime>18:45</endTime><projectId>657</projectId><taskStoryId></taskStoryId></task></tasks>
<?xml version="1.0" encoding="UTF-8"?><tasks><task><date>2019-01-23</date><initTime>17:45</initTime><endTime>18:45</endTime><projectId>657</projectId><taskStoryId></taskStoryId></task></tasks>
Both requests were trying to create the same task, and only one of them succeeded. As a result, one of them responded with an error, and the error message was shown.
<return service="createTasks"><success>true</success><ok>Operation Success!</ok><tasks><task><id>417047</id><date format="Y-m-d">2019-01-23</date><initTime>17:45</initTime><endTime>18:45</endTime><story/><telework/><onsite/><ttype/><text/><phase/><userId>76</userId><projectId>657</projectId><taskStoryId/></task></tasks></return>
<return service="createTasks"><success>false</success><error id="1">There was some error while creating the tasks</error></return>
I think one of the requests was issued by the auto-save, while the other one was issued when manually pressing "save".
Developers can reproduce this problem easily by adding a sleep(10) call in web/services/createTasksService.php. Then, they can open the network inspector, create a task, wait for the automatic save to happen and click on "save" to send the duplicated request.
We are in the process of rewriting the frontend for tasks. Any outstanding bugs and enhancements for the old interface will be taken into account as we implement the new design.