platelet-app / platelet

Dispatch system for emergency volunteer couriers.
https://platelet.app
Apache License 2.0
38 stars 10 forks source link

Basic support for recurring scheduled tasks #155

Closed duckbytes closed 1 year ago

duckbytes commented 1 year ago

Support for automatic daily recurring tasks.

Adds a view to see all the scheduled tasks set up. Add button is visible to admins.

image

An overview for making changes or disabling a scheduled task can be viewed by clicking on a card.

image

Adding a scheduled task view looks like this. Most components are similar to the guided setup components.

image

A lambda function runs each day at midnight. This adds the tasks to the system automatically and moves them to a PENDING status:

image

There is a notification badge at the top to show any unclaimed tasks in PENDING. You can accept or reject a job either by selecting them, using the context menu, or by opening the overview:

image

When you accept or reject a task you are assigned to it as a coordinator. Accepted tasks are moved to NEW and rejected moved to REJECTED with the time of rejection. You can also add a reason for rejection if you use selection mode, otherwise add it as a comment like usual.

Admins can add and change scheduled tasks. Coordinators can see pending tasks and accept or reject them.

This should work well enough for daily jobs like the air ambulance runs. More features are planned for this (https://github.com/platelet-app/platelet/discussions/149), but this will get us up and running.

@Joetooker95 @Merseybiker can you provide feedback please?

codecov-commenter commented 1 year ago

Codecov Report

Merging #155 (700809d) into master (a5a9f56) will increase coverage by 0.96%. The diff coverage is 82.24%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   70.57%   71.53%   +0.96%     
==========================================
  Files         278      301      +23     
  Lines        9437     9999     +562     
  Branches     2497     2635     +138     
==========================================
+ Hits         6660     7153     +493     
- Misses       2554     2625      +71     
+ Partials      223      221       -2     
Impacted Files Coverage Δ
src/App.tsx 0.00% <ø> (ø)
src/apiConsts.ts 100.00% <ø> (ø)
src/components/ClearButtonWithConfirmation.js 76.92% <ø> (ø)
src/components/TaskStatusChip.tsx 64.70% <ø> (ø)
src/components/TextFields.js 61.34% <ø> (ø)
src/graphql/subscriptions.ts 0.00% <0.00%> (ø)
src/hooks/useModelQuery.ts 0.00% <0.00%> (ø)
src/models/schema.js 100.00% <ø> (ø)
src/navigation/MainWindow.js 0.00% <0.00%> (ø)
src/navigation/MenuMainContainer.js 0.00% <0.00%> (ø)
... and 64 more

... and 3 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Joetooker95 commented 1 year ago

This looks very good Theo.

duckbytes commented 1 year ago

Thanks Joe!

We'll have to take some care when we roll this out. Tasks will be created regardless of if the previous ones were claimed. If we know that someone isn't going to use the app for a particular shift, we'll either need to disable all the scheduled tasks the night before, or someone will need to go in each night and reject the created ones.

Joetooker95 commented 1 year ago

Hi Theo,Let’s get it active and then I will keep on top of ensuring they are disabled at times it isn’t being used by coords, however I am now working through rolling it out to the rest of the charity and so I am hoping by the end of June we will be completely live.Only thing I really needed to check with you was the reports, do we still only have access to the last 2 weeks? This is something we will need to have full access to before going completely live as we will need to rely on it to get historic data.Kind regardsJoe TookerOn 18 May 2023, at 15:43, Theo @.***> wrote: Thanks Joe! We'll have to take some care when we roll this out. Tasks will be created regardless of if the previous ones were claimed. If we know that someone isn't going to use the app for a particular shift, we'll either need to disable all the scheduled tasks the night before, or someone will need to go in each night and reject the created ones.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

duckbytes commented 1 year ago

I'll add some enable all and disable all buttons to the list view to make it a bit easier for you.

Sounds great about the plan to go live. I can look at reports now this is mostly finished. There are some other reasons I want to make the report view better, so probably a good time to improve it.

Joetooker95 commented 1 year ago

Thanks Theo, another 4 coords trained tonight.Kind regardsJoe TookerOn 18 May 2023, at 18:38, Theo @.***> wrote: I'll add some enable all and disable all buttons to the list view to make it a bit easier for you. Sounds great about the plan to go live. I can look at reports now this is mostly finished. There are some other reasons I want to make the report view better, so probably a good time to improve it.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Merseybiker commented 1 year ago

Hi Theo and Joe. The scheduled tasks enhancement looks great - some general comments and questions from MCBB: 1) We have some runs that are weekly but not every day - for instance one surgery pickup is every Tuesday and Thursday weekly. Can it cope with that ? 2) When will the enhancement be pushed out to our Platelet production ? I can't yet see it on the pilot environment...

duckbytes commented 1 year ago

Hi Steve.

We have some runs that are weekly but not every day - for instance one surgery pickup is every Tuesday and Thursday weekly. Can it cope with that ?

No it isn't supported yet, but I have it in my plans. One way to work around it would be for an admin to enable the scheduled task the night before and disable it after. Not ideal I know.

When will the enhancement be pushed out to our Platelet production ? I can't yet see it on the pilot environment...

I've been letting it run on my test instance for a few days and it seems to be working well, so I'll probably merge this to master later today. I could push it up to your instance at the same time if you'd like?

Merseybiker commented 1 year ago

When will the enhancement be pushed out to our Platelet production ? I can't yet see it on the pilot environment...

I've been letting it run on my test instance for a few days and it seems to be working well, so I'll probably merge this to master later today. I could push it up to your instance at the same time if you'd like?

Yes please Theo....