Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As to keep up-to-date with platforms change, refactor handling of TaskList retrieval and live updates in the app #1803

Open
Atala opened this issue May 29, 2024 · 2 comments
Labels
Courier Interface An issue related to a courier´s interface. Ex: closing a task, shift planning Dispatch Interface An issue related to dispatch´s interface. Ex: The admin and orders dashboards, using matomo, tags Improve Performance Technical Debt

Comments

@Atala
Copy link
Member

Atala commented May 29, 2024

What was done on the platform ?

I did the following changes

  • TaskList is now a list of both tasks and tours
  • TaskList items are normalized as IDs not as whole objects, i.e. items = ['/api/tasks/1'] not items = [{'@id': 1....}]. I think it will improve performances (as you dont fetch task info (packages, organization, assignedTo, incidents...)
  • also as a side note I now use the tasklist:updated event in the dashboard so it removes a (circular) dependencies when you will listen to the 'task:assigned' event to update the tasklist objects (which was causing headach and complex code)

What is the problem with the app?

  • doesn't know about the concept of tours
  • expects /api/me/tasks to be a list of tasks objects at items key, not IDs
  • it expects the task_list:updated to have tasks objects as items, not tasks IDs
  • it expects to load /api/task_lists to return task_list with items that are a list of task objects

Remarks

  • I think that sending the items as IDs makes more sense, otherwise you duplicate the state in dispatch and you have a lot of synchronization tasks to make. (tasks objects will be present under entites.tasks and entities.tasks_lists.items)
  • the fact that app doesnt know about tours is mitigable, but at some point if a web dispatcher creates tours, an app dispatcher will break stuff, as he will see only tasks in his dispatch

Mitigation/workarounds

  • the main pain point is on the TaskList endpoint and task_list:updated event
  • I don't think their are proper workarounds, as these changes are breaking compability between the two

so I created the following :

  • TaskList v2 event : v2:task_list:updated that will return a tasklist with ids (both tours and tasks as items)
  • /api/task_list/v2 endpoint that will return a tasklist with ids (both tours and tasks as items)

Cleanup

remove the legacy non-v2 endpoints and events

@alexsegura
Copy link
Member

remove the legacy non-v2 endpoints and events

This will be possible when nobody uses those endpoints anymore, needs monitoring.

@Atala
Copy link
Member Author

Atala commented Oct 15, 2024

for now the app uses it for sure

@Paul-Eraman-CoopCycle Paul-Eraman-CoopCycle added Improve Performance Courier Interface An issue related to a courier´s interface. Ex: closing a task, shift planning Dispatch Interface An issue related to dispatch´s interface. Ex: The admin and orders dashboards, using matomo, tags and removed enhancement labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Courier Interface An issue related to a courier´s interface. Ex: closing a task, shift planning Dispatch Interface An issue related to dispatch´s interface. Ex: The admin and orders dashboards, using matomo, tags Improve Performance Technical Debt
Projects
None yet
Development

No branches or pull requests

3 participants