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

feat(datatrak): RN-1398: Setup task scheduler #5841

Merged
merged 7 commits into from
Aug 15, 2024

Conversation

tcaiger
Copy link
Contributor

@tcaiger tcaiger commented Aug 14, 2024

Issues

Changes:

  • new base ScheduledTask class
  • TaskOverdueChecker
  • Add a script for running scheduled tasks on demand

Screenshots:

Screenshot 2024-08-15 at 10 30 08 AM

@tcaiger tcaiger changed the title Rn 1398 setup task scheduler feat(datatrak): RN-1398: Setup task scheduler Aug 14, 2024
Copy link
Contributor

@alexd-bes alexd-bes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple, I love it! I just have some questions around renaming to be jobs instead of tasks so we don't confuse these with our actual tasks. Also a quick question on how we set name and schedule, but I'm not married to it.
Happy to pre-approve

import { TaskOverdueChecker } from '../src/scheduledTasks';
import * as modelClasses from '../src/database/models';

const TASKS = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is picky but I can just see us getting confused between tasks and schedules tasks. Perhaps we can call these scheduled jobs/events instead so the distinction is clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep good point

@@ -117,4 +123,11 @@ configureEnv();
winston.error(error.message);
}
}

/**
* Gracefully handle shutdown of ChangeHandlers and ScheduledTasks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Gracefully handle shutdown of ChangeHandlers and ScheduledTasks
* Gracefully handle shutdown of ScheduledTasks

return '0 * * * *'; // every hour
}

getName() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on making it possible to just set this.name = XXX and this.schedule = XXX, similar to how we set things in central-server CRUD handlers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good point. I liked the functions so that I could have the nice errors but I found another easy way of handling that.

@tcaiger tcaiger merged commit 79551a2 into epic-tasks Aug 15, 2024
42 of 43 checks passed
@tcaiger tcaiger deleted the rn-1398-setup-task-scheduler branch August 15, 2024 04:26
alexd-bes added a commit that referenced this pull request Sep 16, 2024
* No data display

* Fix tests

* Reorganise files

* tweaks

* Add loading state

* Exclude tasks from ios

* tweaks

* Types fix

* Make due date nullable

* Rename repeat_schedule field

* Tweaks

* Fix tests

* Revert "Fix tests"

This reverts commit 0e566d3.

* Fix tests

* Fix validation rules

* Link status and assignee name to records at the model level

* Generate types

* Fix types and apply new field names

* Get tasks filters working

* Fix pagination

* Fix build

* refactor(adminPanel): RN-1336: Move modal into ui-components (#5765)

* Move modal to ui-components

* Fix build

* Reorder import

* Enable popover portal

* feat(datatrakWeb): RN-1336: Create a task workflow (#5763)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* feat(datatrakWeb): RN-1338: Mark tasks as completed when survey responses are submitted (#5766)

* Create migration for created_at column

* Create change handler

* fix(types):Update schemas.ts

* feat(datatrakWeb): RN-1358: Assign tasks from dashboard (#5770)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Fix modal button types

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* feat(datatrakWeb): RN-1314: add return to tasks button on success screen (#5747)

* add back to tasks button

* use useFromLocation

* update types

* Update SurveySuccessScreen.tsx

* save task endpoint

* save task mutation

* task cancel modal

* update types

* pass from location into useSubmitSurveyResponse

* remove SaveTaskRequest

* Update TasksTable.tsx

* refactor action button

* fix(datatrakWeb): Fix table height

* tweak(datatrakWeb): Use full month name in repeat schedule options

* fix(datatrakWeb): Handle errors when loading creating task modal

* fix(datatrakWeb): Hide actions on completed and cancelled tasks

* tweak(datatrakWeb): Update repeating schedule input to be matching autocomplete

* fix(datatrakWeb): Change select list focus styling slightly

* fix(datatrakWeb): Fix UTC date issue

* fix(datatrakWeb): fix focus styles on select filter

* fix(datatrakWeb): Fix type error

* tweak(datatrakWeb): Change text on complete task button

* fix(datatrakWeb): remove redundant file

* fix(datatrakWeb): Fix assignee autocomplete

* tweak(datatrakWeb): Navigate user to project select screen on 403 entities error

* feat(datatrak): RN-1343: Task dashboard filter settings (#5757)

* add back to tasks button

* use useFromLocation

* update types

* Update SurveySuccessScreen.tsx

* save task endpoint

* save task mutation

* task cancel modal

* update types

* pass from location into useSubmitSurveyResponse

* build ui

* set up filtering

* testing filters

* Update useTasks.ts

* fix front end

* filtering with cookies

* update cookie handling

* clean up types

* refactor tasks route

* handle invalidFilterValues

* Create TaskRoute.test.ts

* sort by status

* clear cookies on logout

* Delete SaveTaskRoute.ts

* renaming

* tweak(datatrakWeb): Make search fuzzy always

* tweak(datatrakWeb): RN-1358: Assign task modal changes (#5784)

* Update design for assign modal

* Update schemas.ts

* PR fixes

* Update taskFilterSettings.ts

* Update ActionButton.tsx

* feat(datatrakWeb): RN-1329: Task details view (#5783)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Link to details page

* Fix modal button types

* Fix types

* Update handling of columns

* get task route

* WIP

* Link to survey for incomplete tasks

* Handle unloaded task

* Task metadata section

* Fix merge issue

* WIP

* Update schemas.ts

* feat(datatrakWeb): RN-1358: Assign tasks from dashboard (#5770)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Fix modal button types

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix merge error

* Fix styles and types

* Styling

* Fix multi re-render

* Comments placeholder

* Add buttons

* Submit changes

* Clear changes

* Fix merge issues

* Disable inputs when task is completed or cancelled

* responsive styling

* Add cancel menu

* Generate types

* Fix loading styling

* Remove unused var

* Handle onSuccess of edit task

* PR fixes

* PR fixes

* Remove form provider

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* fix tasks button

* removeTaskFilterSetting on logout

* fix(datatrakWeb): Make 'unassigned' searchable

* fix(datatrakWeb): Fix task row links

* fix(datatrakWeb): Fix task styling

* tweak(datatrakWeb): Tweak styling of task details view

* fix(adminPanel): Fix merge

* Fix build

* feat(datatrak): RN-1314: Auto populate entity question (#5793)

* set primary entity

* survey response

* Update SurveyResponsePage.tsx

* feat(datatrak): RN-1313: My tasks section (#5776)

* add tasks section

* create task tile

* NoTasksSection

* styling

* styling landing page

* styling

* Update TaskTile.tsx

* pr changes

* styling

* responsive styles

* Update useTasks.ts

* fix use tasks

* Update TasksRoute.ts

* Update TaskTile.tsx

* Update SurveyScreen.tsx

* Fix build

* tweak(datatrakWeb): RN-1339: Move survey response page into modal (#5786)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Link to details page

* Fix modal button types

* Fix types

* Update handling of columns

* get task route

* WIP

* Link to survey for incomplete tasks

* Handle unloaded task

* Task metadata section

* Fix merge issue

* WIP

* Update schemas.ts

* feat(datatrakWeb): RN-1358: Assign tasks from dashboard (#5770)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Fix modal button types

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix merge error

* Fix styles and types

* Styling

* Fix multi re-render

* Comments placeholder

* Add buttons

* Submit changes

* Clear changes

* Fix merge issues

* Disable inputs when task is completed or cancelled

* responsive styling

* Add cancel menu

* Generate types

* Fix loading styling

* Remove unused var

* Handle onSuccess of edit task

* Display modal

* Survey response modal

* Handle isResponseScreen flag

* Error handling

* Error handling

* Fix tests

* Remove country and survey code from url

* Fix imports

* feat(datatrakWeb): RN-1339: Link survey responses to tasks (#5788)

* Create survey_response_id column

* Update change handler

* Update TaskCompletionHandler.js

* Fix type

* feat(datatrakWeb): RN-1339: View completed survey response from task (#5789)

* Create survey_response_id column

* Update change handler

* View completed survey

* Error handling

* Fix comment

* fix tasks button

* removeTaskFilterSetting on logout

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix build

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* feat(datatrak): RN-1357: Task created toast message (#5798)

Update useCreateTask.ts

Co-authored-by: alexd-bes <129009580+alexd-bes@users.noreply.github.com>

* feat(datatrakWeb): RN-1381: Add new question types (#5807)

* Add User and Task question types

* Add question config types

* Update types

* Update types

* Fix surveyCode type

* feat(datatrak): RN-1364: Completing of repeat tasks (#5802)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Link to details page

* Fix modal button types

* Fix types

* Update handling of columns

* get task route

* WIP

* Link to survey for incomplete tasks

* Handle unloaded task

* Task metadata section

* Fix merge issue

* WIP

* Update schemas.ts

* feat(datatrakWeb): RN-1358: Assign tasks from dashboard (#5770)

* Create button

* Move modal to ui-components

* Move country selector to features folder

* Update country selector exports/imports

* Update tupaia-pin.svg

* Country selector on modal

* Move survey selector to features

* Move types

* Update survey list component to take care of fetching

* Survey selector

* Move entity selector to features

* Fix types

* Entity selector

* Styling entity selector

* Due date

* WIP

* WIP

* assignee input

* Add loading state and save user id

* Styling repeat scheduler

* Comments placholder

* Styling

* WIP

* Create task route

* Create task workflow

* Clear form when modal is reopened

* Update schemas.ts

* remove unused import

* Handle reset

* Fix datatrak tests

* Fix central server tests

* Move modal to ui-components

* Remove unused import

* Remove duplicate file

* Fix build

* Fix tests

* Update packages/central-server/src/apiV2/utilities/constructNewRecordValidationRules.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix error messages

* Handle search term in the BE

* WIP

* WIP

* Assignee Id modal

* Working assignee

* remove unused property

* Fix timezone issue

* Fix date formatting of filter

* remove unused variable

* Remove unused variable

* Fix casing

* Default to showing countries if no primary entity question

* Update AssigneeInput.tsx

* Show loader when loading project and countries

* Fix copy

* Exclude internal users

* Fix types

* Change colour of icon in entity list

* Fix modal button types

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix merge error

* Fix styles and types

* Styling

* Fix multi re-render

* Comments placeholder

* Add buttons

* Submit changes

* Clear changes

* Fix merge issues

* Disable inputs when task is completed or cancelled

* responsive styling

* Add cancel menu

* Generate types

* Fix loading styling

* Remove unused var

* Handle onSuccess of edit task

* Display modal

* Survey response modal

* Handle isResponseScreen flag

* Error handling

* Error handling

* Fix tests

* Remove country and survey code from url

* Fix imports

* feat(datatrakWeb): RN-1339: Link survey responses to tasks (#5788)

* Create survey_response_id column

* Update change handler

* Update TaskCompletionHandler.js

* Fix type

* feat(datatrakWeb): RN-1339: View completed survey response from task (#5789)

* Create survey_response_id column

* Update change handler

* View completed survey

* Error handling

* Fix comment

* fix tasks button

* removeTaskFilterSetting on logout

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update TaskCompletionHandler.test.js

* handle repeatSchedule tasks

* set up duplicate test

* clean up PR

* allow null repeating tasks

---------

Co-authored-by: alexd-bes <129009580+alexd-bes@users.noreply.github.com>

* feat(datatrakWeb): RN-1331: Task comments setup (#5800)

* Create task comment table and generate types

* Create Model

* WIP

* WIP

* Working endpoints

* Generate types

* Fix test

* Update 20240719015050-AddTaskCommentsTable-modifies-schema.js

* Remove task comments endpoints

* Revert "Remove task comments endpoints"

This reverts commit 498b1be.

* Fix revert

* feat(datatrakWeb): RN-1331: Task comments UI (#5801)

* Create task with comments

* View comments on task details

* Allow create comment on edit task

* Display comments count on table

* Show comment count on tasks tile on landing page

* Fix up types

* Order comments descending

* Update schemas.ts

* Move comment adding to central server

* Update schemas.ts

* Fix types

* build fixes

* Revert "Remove task comments endpoints"

This reverts commit 498b1be.

* Remove task comment create endpoint as no longer needed

* Fix merge errors

* Fix build

* feat(datatrakWeb): RN-1391: Generate system comments for tasks (#5806)

* Create task comment table and generate types

* Create Model

* WIP

* WIP

* Working endpoints

* Generate types

* Fix test

* Create task with comments

* Update 20240719015050-AddTaskCommentsTable-modifies-schema.js

* View comments on task details

* Allow create comment on edit task

* Display comments count on table

* Show comment count on tasks tile on landing page

* Fix up types

* Order comments descending

* Update schemas.ts

* addTaskComment on model

* Generate comment on edit task

* Generate comments on create of task

* Generate system message on task completion

* Syetm task styling

* Handle editing a task with just a comment

* Move comment handling to central server

* Move comment adding to central server

* Update schemas.ts

* Fix types

* Remove task comments endpoints

* build fixes

* Add comments

* Revert "Remove task comments endpoints"

This reverts commit 498b1be.

* Remove task comment create endpoint as no longer needed

* Revert "Remove task comments endpoints"

This reverts commit 498b1be.

* Fix revert

* Handle recurring task comments

* feat(datatrakWeb): RN-1331: Task comments UI (#5801)

* Create task with comments

* View comments on task details

* Allow create comment on edit task

* Display comments count on table

* Show comment count on tasks tile on landing page

* Fix up types

* Order comments descending

* Update schemas.ts

* Move comment adding to central server

* Update schemas.ts

* Fix types

* build fixes

* Revert "Remove task comments endpoints"

This reverts commit 498b1be.

* Remove task comment create endpoint as no longer needed

* Fix import order

* PR changes

* Fix change handler tests

* Update TasksRoute.ts

* Update taskFilterSettings.ts

* feat(adminPanel): RN-1381: Ability to import task and user questions in surveys (#5813)

* Add User and Task question types

* Add question config types

* Update types

* Update types

* Fix surveyCode type

* WIP

* Ability to import config

* WIP

* User permission group validation

* Add comment

* Handle exporting of questions

* Hide the task question always

* Handle BES admin users

* Handle multiple task questions

* rename entityCode to entityId

* Generate types

* Update SurveyContext.tsx

* Update TaskCompletionHandler.js

* feat(datatrakWeb): RN-1362: Datatrak Web User question type (#5815)

* New endpoint

* Question

* Add tests

* Generate types

* PR fixes

* feat(datatrak) RN-1340: Cancel task modal design update (#5819)

update modal design

* fix merge conflicts

* tweak(datatrakWeb): Update tooltip on tasks dashboard

* feat(datatrak): RN-1373: Task question (#5809)

* task creation handler

* get answers for task questions

* handle saving string values

* Update TaskCreationHandler.test.js

* Update surveyScreenComponent.ts

* move change handler to central server

* move helpers to central server

* handle primary entity question

* generate types

* clean up

* Update TaskCreationHandler.js

* move back to database

* fix fe tests

* handle success message

* handle should_create_task

* fix tests

* fix tests

* remove test code

* update types

* refactor

* Update getTaskQuestionField.ts

* remove toast message

* hide task questions on the server side

* Update SurveyRoute.ts

* remove survey_response_id

* fix tests

* update types

* test multiple task questions

* update types

* Update schemas.ts

* tweak(datatrakWeb): RN-1331: Update to task details/comments (#5823)

* WIP

* UI comments

* Remove comment handling on edit task

* Create task comment endpoint

* Link to task from landing page, and back button

* CHange back icon

* Update tests

* Don't navigate back on successful task save

* Remove double default values

* feat(datatrak): RN-1314: Handle task completion when submitting a survey (#5826)

* handle task completion inline

* update task completion handling

* Clean up

* Update index.js

* update comments

* pr review tweaks

* fix handle completion

* Update TaskDetailsPage.tsx

* feat(meditrakApp): RN-1361: User type question (#5820)

* Add User and Task question types

* Add question config types

* Update types

* Update types

* Fix surveyCode type

* WIP

* Ability to import config

* WIP

* User permission group validation

* Add comment

* Handle exporting of questions

* Hide the task question always

* Handle BES admin users

* Handle multiple task questions

* rename entityCode to entityId

* Generate types

* Add sync configs

* Update permissions based sync queue for user entity permissions

* Add user entity permissions to sync queue

* Sync user accounts

* User account syncing

* Make realm explorer scroll

* Fix permissions based sync queue for user entity permissions

* Add database type for user entity permission

* Make separate user account model

* Working question

* Fix user model usage

* Working question with permission groups

* Update schema.jsx

* add comments

* Handle filtering and pagination

* Use permission group id instead of name

* Update filtering

* PR fixes

* Add internal field to users

* fix shouldCreateTask

* Update TaskCreationHandler.js

* Display parent entity name next to entity name

* Update task details buttons

* Generate types

* Reset pagination on filter change

* fix(datatrakWeb): Fix permissions on tasks

* feat(tasks): RN-1372: Email templating (#5830)

* Working template setup

* v1

* Generic template working

* Request country access

* Delete account request

* Rename templates

* Password reset template

* Verify email

* Permission granted email

* email after timeout

* dashboard subscription emails

* Handle no template name

* Make subfolder for content

* Update pagination no records text

* Fix tests

* feat(datatrak): RN-1330: View initial request for a task (#5832)

* add initial_request_id and modal

* remove unused useSurveyResponseWithForm

* Update useSurveyResponseWithForm.ts

* Update TaskDetails.tsx

* update types

* Update TaskDetails.tsx

* fix tests

* feat(datatrakWeb): RN-1337: Send emails to assignee of tasks (#5834)

* Working template setup

* v1

* Generic template working

* Request country access

* Delete account request

* Rename templates

* Password reset template

* Verify email

* Permission granted email

* email after timeout

* dashboard subscription emails

* Handle no template name

* Make subfolder for content

* Add email template

* WIP

* Add env

* Update configureEnv.js

* Working email handler

* Tests

* Remove log

* Remove duplicate model

* Add trigger creation in runPostMigration

* Allow assignee question to be empty or non-mandatory

* Fix tests

* Revert to starts with search

* Fix tests

* Fix comment details colour

* Don't email assignees when completed repeating tasks are created

* Fix tests

* Update LandingPage.tsx

* tweak(datatrakWeb): RN-1417: save parent task to completed repeating tasks (#5840)

* Ad column to tasks table

* Handle completion of repeating tasks

* feat(datatrak): RN-1398: Setup task scheduler (#5841)

* setup scheduled task

* set up email template

* update script

* clean up

* PR suggestions

* Update ScheduledTask.js

* Basic responsive styling

* Task header back button

* Layout tidy ups

* Remove warning log

* Scroll tidying

* Generate types

* Merge fixes

* Fix build

* tweak emails

* tweak(datatrakWeb): RN-1400: save task due date in unix time (#5838)

* Change due date to be number

* Working time zone saving

* Save dates

* Working filters

* Fix tests

* Task creation handler tests

* database tests

* Central server tests

* Fix merge conflict error

* handle timezones

* Fix tests

* Handle creating tasks in timezone

* Set ms to be 0

* Fix tests

* Add task route test

* Update packages/datatrak-web-server/src/routes/TasksRoute.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Make custom column selector for due dates

* Update due date field

* build fixes

* Build fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Make survey success direct to tasks where applicable

* add a default sort

* Fix user question

* Filter surveys by permission group and country

* Handle when no permissions for country

* fix(datatrakWeb): Limit entity results to 100 (#5847)

Fix(datatrakWeb): Limit entity results to 100

* Update SurveyContext.tsx

* Show all users for public surveys

* Fix font weights

* Convert permission groupI ID to name when exporting survey

* Handle assignee lists and search

* Generate types

* feat(datatrakWeb): RN-1341: Repeating tasks (#5844)

* WIP rrule

* Working rrule utils

* Add generic rrule handler

* frequency enum

* types

* handle repeat schedule in task changes

* Create and edit repeating tasks

* Handle system comments

* Creating and editing with comments

* WIP

* Update filtering

* disable sort by repeat frequency

* Add next occurrence handler

* Apply due date to completed tasks

* Handle bugs

* Update tests

* Update yarn.lock

* Mark due date of tasks

* Comments and tidy ups

* Use timestamp for due date

* Fix tests

* add comments

* Move getRepeatScheduleOptions

* Remove duplicate identifier

* Allow removing of repeat schedule

* feat(datatrak): RN-1314: Auto fill primary entity questions for a survey (#5853)

* useEntityAncestors

* entityAncestors

* clean up

* refactoring

* refactor getEntityQuestionAncestorAnswers

* refactor usePrimaryEntityLocation

* autofill in survey context

* add test

* Update usePrimaryEntityQuestionAutoFill.ts

* Update schemas.ts

* fix test

* Repeating task fixes

* Reset tasks pagination to 0 when filter checkbox value changes

* Handle overdue tasks with no assignee

* styling tidy ups

* Handle multiline task comments

* Add entity name to modals

* Fix user question re-renders

* Update task entities on survey response edit

* tweak(datatrakWeb): RN-1391: Update system comments handling (#5859)

* Task comment changes

* Tidy ups

* Update Task.js

* interceptor for creating tasks

* Editing tidyups

* central server tests

* Task tests

* Merge fixes

* Comment fix

* build fixes

* Fix type error

* Display entity parent name on survey response modals

* Fix user question values disappearing

* Fix user not showing in survey response

* Display 'user deleted' message for deleted message

* Remove review section headings

* Generate types

* Update SurveyReviewSection.tsx

* Amend db migration for meditrak sync queue

* Tidy up migration

* Handle exporting of answers for user questions

* Admin panel user question fixes

* Check for user config being allowed access to the survey

* Should validate that surveyCode is set

* Add validation for task config question types and multi field validation errors

* Update TaskConfigValidator.js

* Update task assignee question validation

* Don't remove instruction questions on survey review screens

* Undo change with multiple config being validated at once

* Update importSurveyQuestions.js

* Remove unused import

* Handle user question names with special characters

* Use locale for datepicker

* feat(datatrakWeb): RN-1374: Task Metrics (#5860)

* task metrics

* types update

* Update useCreateTask.ts

* review changes

* review updates

* update to MUI breakpoints

* Review updates

* Update TaskCompletionHandler.js

* tasks section responsive styles

* Update SurveyContext.tsx

* Complete tasks based on survey response end time

* Create permissions based sync queue on first startup

* Handle survey responses with no parent name

* Make use of util for survey review screen

* tweak(datatrakWeb): RN-1374: Dashboard Metrics Updates (#5864)

* task metrics

* types update

* Update useCreateTask.ts

* review changes

* review updates

* update to MUI breakpoints

* Review updates

* Update TaskCompletionHandler.js

* updates

* Update permissions based sync handler on startup

* Allow removal of repeat schedule

* Handle db migrations error

* Fix types

* Remove unused var

* Test

* Update index.js

* fix(datatrak): RN-1330: Fix logout request cache clearing (#5865)

* Update Tile.tsx

* wip

* cleanup

* Update TaskTile.tsx

* tweak(datatrakWeb): RN-1374: Dashboard Metrics Updates (#5866)

* task metrics

* types update

* Update useCreateTask.ts

* review changes

* review updates

* update to MUI breakpoints

* Review updates

* Update TaskCompletionHandler.js

* updates

* Rounding up completion rate

* Update SingleSurveyResponseRoute.ts

* Update getDbMigrator.js

* Fix error on due date updater

* Fix broken deployment

* Wrap sync queue handler in feature flag checker

* Update scheduledTask.js

* Allow past due dates in some cases

* Fix env vars

* fix task link

* Update usePrimaryEntityQuestionAutoFill.ts

* Update TaskTile.tsx

* Handle user changes

* Update TaskOverdueChecker.js

* remove due date from overdue email

* Remove due date from assignee emails

* fix(datatrak): Fix survey autofill loading (#5883)

* add loading

* Update TaskOverdueChecker.js

* overdue email comment

* Update schemas.ts

* Update yarn.lock

* Regenerate types

* Fix build

* Fix apostrophe and single quote search

* Fix build

* Fix random 0

* Sort filtered users

* Sync all user entity permissions by country, instead of by country and permission group

* Update TaskComment.js

* Force a full resync on update to version 26

* TEST

* Update version

* fix(datatrak): RN-1314: Update autofilling entity when completing a task (#5893)

move primary entity code to url params

* TEST

* Fix react-query updates

* Fix ordering of keys

* Update migration

* Keep survey search on page change

* handle loading state

* Use isSuccess instead of loading state for use effect

* Fix loading race conditions

* Disable backdating of tasks

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Salman <114740396+hrazasalman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants