From b6078edb721b0a6eb19cae632833563cca0b995a Mon Sep 17 00:00:00 2001 From: Shubham Kumar Singh <107163260+shubhamsigdar1@users.noreply.github.com> Date: Wed, 1 Nov 2023 02:42:48 +0530 Subject: [PATCH 1/4] Replace 'COMPLETED' Option with 'DONE' (#515) * change completed to done * modify test * written test for model of 100% progress bar * written test for DONE option * written test for DONE option * added statusNotOverDueList under feature flag * added statusNotOverDueList under feature flag * added feature flag when on ompletedPercentage * added feature flag in select option * remove redudant code --- app/components/task/holder.hbs | 17 +++--- app/components/task/holder.js | 15 ++++- app/constants/tasks.js | 8 ++- app/controllers/tasks.js | 9 ++- tests/integration/components/tasks-test.js | 2 +- .../components/tasks/holder-test.js | 58 +++++++++++++++++++ .../components/tasks/modal-test.js | 36 ++++++++++++ 7 files changed, 132 insertions(+), 13 deletions(-) diff --git a/app/components/task/holder.hbs b/app/components/task/holder.hbs index b6b38809..6bd917b9 100644 --- a/app/components/task/holder.hbs +++ b/app/components/task/holder.hbs @@ -39,15 +39,14 @@ id='task-update' {{on 'change' this.onStatusChange}} > - {{#each this.availabletaskStatusList as |taskStatus|}} - {{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}} - - {{/if}} + {{#each this.taskStatusList as |taskStatus|}} + {{/each}} diff --git a/app/components/task/holder.js b/app/components/task/holder.js index 4e058848..8fbac86a 100644 --- a/app/components/task/holder.js +++ b/app/components/task/holder.js @@ -14,9 +14,22 @@ export default class TasksHolderComponent extends Component { TASK_KEYS = TASK_KEYS; availabletaskStatusList = TASK_STATUS_LIST; + get taskStatusList() { + const statusToDisplay = this.availabletaskStatusList.filter( + (taskStatus) => { + if (this.args.dev === true) { + return taskStatus.key !== 'ALL' && taskStatus.key !== 'COMPLETED'; + } else { + return taskStatus.key !== 'ALL' && taskStatus.key !== 'DONE'; + } + } + ); + return statusToDisplay; + } + get taskStyleClass() { const statusNotOverDueList = [ - TASK_KEYS.COMPLETED, + this.args.dev === true ? TASK_KEYS.DONE : TASK_KEYS.COMPLETED, TASK_KEYS.VERIFIED, TASK_KEYS.AVAILABLE, ]; diff --git a/app/constants/tasks.js b/app/constants/tasks.js index 3947ee71..c9e1d843 100644 --- a/app/constants/tasks.js +++ b/app/constants/tasks.js @@ -6,6 +6,7 @@ const TASK_KEYS = { BLOCKED: 'BLOCKED', SMOKE_TESTING: 'SMOKE_TESTING', COMPLETED: 'COMPLETED', + DONE: 'DONE', NEEDS_REVIEW: 'NEEDS_REVIEW', IN_REVIEW: 'IN_REVIEW', APPROVED: 'APPROVED', @@ -24,6 +25,7 @@ const { BLOCKED, SMOKE_TESTING, COMPLETED, + DONE, NEEDS_REVIEW, IN_REVIEW, APPROVED, @@ -63,6 +65,10 @@ const TASK_STATUS_LIST = [ displayLabel: 'Completed', key: COMPLETED, }, + { + displayLabel: 'Done', + key: DONE, + }, { displayLabel: 'Needs Review', key: NEEDS_REVIEW, @@ -133,7 +139,7 @@ const TABS_TASK_STATUS_LIST = [ ]; export const TASK_MESSAGES = { MARK_DONE: - 'This task will be marked as complete and a new task will be assigned to you', + 'This task will be marked as done and a new task will be assigned to you', UPDATE_TASK: 'Updating task', FIND_TASK: 'Finding new task for you!', }; diff --git a/app/controllers/tasks.js b/app/controllers/tasks.js index 917d448a..bdcfbe04 100644 --- a/app/controllers/tasks.js +++ b/app/controllers/tasks.js @@ -16,6 +16,7 @@ const API_BASE_URL = ENV.BASE_API_URL; export default class TasksController extends Controller { queryParams = ['dev']; @service toast; + @service featureFlag; TASK_KEYS = TASK_KEYS; taskStatusList = TASK_STATUS_LIST; tabsTaskStatusList = TABS_TASK_STATUS_LIST; @@ -42,6 +43,10 @@ export default class TasksController extends Controller { @tracked showFetchButton = this.isShowFetchButton() && !this.alreadyFetched; alreadyFetched = localStorage.getItem('already-fetched'); + get isDevMode() { + return this.featureFlag.isDevMode; + } + @action toggleDropDown() { this.showDropDown = !this.showDropDown; } @@ -93,7 +98,9 @@ export default class TasksController extends Controller { const taskCompletionPercentage = object.percentCompleted; if (taskCompletionPercentage) { if (taskCompletionPercentage === TASK_PERCENTAGE.completedPercentage) { - requestBody.status = 'COMPLETED'; + this.isDevMode === true + ? (requestBody.status = 'DONE') + : (requestBody.status = 'COMPLETED'); } requestBody.percentCompleted = parseInt(taskCompletionPercentage); } diff --git a/tests/integration/components/tasks-test.js b/tests/integration/components/tasks-test.js index 67f44022..89922d1e 100644 --- a/tests/integration/components/tasks-test.js +++ b/tests/integration/components/tasks-test.js @@ -68,7 +68,7 @@ module('Integration | Component | tasks', function (hooks) { assert.dom('[data-test-task-spinner]').doesNotExist(); - await fillIn('[data-test-task-status-select]', TASK_KEYS.COMPLETED); + await fillIn('[data-test-task-status-select]', TASK_KEYS.DONE); assert.dom('[data-test-task-spinner]').exists({ count: 1 }); diff --git a/tests/integration/components/tasks/holder-test.js b/tests/integration/components/tasks/holder-test.js index 77ad27c0..836fad05 100644 --- a/tests/integration/components/tasks/holder-test.js +++ b/tests/integration/components/tasks/holder-test.js @@ -210,6 +210,41 @@ module('Integration | Component | Tasks Holder', function (hooks) { .hasValue(TASK_KEYS.IN_PROGRESS); }); + test('Verify values of task status upon api failures under feature flag', async function (assert) { + const testTask = tasksData[3]; + testTask.status = TASK_KEYS.IN_PROGRESS; + + this.set('task', testTask); + this.set('mock', () => {}); + this.set('onTaskUpdate', (taskId, error) => { + error(); + }); + this.set('isLoading', false); + this.set('disabled', false); + this.set('defaultType', DEFAULT_TASK_TYPE); + this.set('dev', true); + + await render(hbs``); + + assert + .dom('[data-test-task-status-select]') + .hasValue(TASK_KEYS.IN_PROGRESS); + + await select('[data-test-task-status-select]', TASK_KEYS.DONE); + + assert + .dom('[data-test-task-status-select]') + .hasValue(TASK_KEYS.IN_PROGRESS); + }); + test('Verify status change to VERIFIED', async function (assert) { const testTask = tasksData[3]; @@ -242,4 +277,27 @@ module('Integration | Component | Tasks Holder', function (hooks) { assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once'); }); + + test('Render Task holder and check whether it has select tag with option DONE under feature flag', async function (assert) { + this.set('task', tasksData[3]); + this.set('mock', () => {}); + this.set('isLoading', false); + this.set('disabled', false); + this.set('defaultType', DEFAULT_TASK_TYPE); + this.set('dev', true); + + await render(hbs``); + + assert.dom('[data-test-task-status-select]').exists(); + assert.dom('[data-test-dropdown-option=Done]').hasText('Done'); + }); }); diff --git a/tests/integration/components/tasks/modal-test.js b/tests/integration/components/tasks/modal-test.js index 2605e76a..f4b62a6f 100644 --- a/tests/integration/components/tasks/modal-test.js +++ b/tests/integration/components/tasks/modal-test.js @@ -190,4 +190,40 @@ module('Integration | Component | tasks/modal', function (hooks) { this.set('isUpdating', false); assert.dom('[data-test-spinner]').doesNotExist(); }); + + test('when the progress bar reaches 100%, a model ais displayed with a message and a "Proceed" button', async function (assert) { + this.setProperties({ + goBack: () => {}, + isUpdating: false, + markComplete: () => {}, + markCompleteAndAssignTask: () => {}, + showModal: true, + buttonRequired: true, + dev: false, + message: + 'This task will be marked as done and a new task will be assigned to you', + }); + + await render(hbs` + + `); + + assert.dom('[data-test-notAssignBtn]').exists(); + assert.dom('[data-test-notAssignBtn]').hasProperty('button'); + assert + .dom('[data-test-title]') + .hasText( + 'This task will be marked as done and a new task will be assigned to you' + ); + assert.dom('[data-test-notAssignBtn]').hasText('Proceed'); + }); }); From c7b74f973a0800550dab76e22a94bb58daecdf3f Mon Sep 17 00:00:00 2001 From: PeeyushPrashant Date: Sun, 5 Nov 2023 21:02:18 +0530 Subject: [PATCH 2/4] fix: removed feature flag --- app/components/user-status.hbs | 2 -- app/controllers/index.js | 3 -- app/templates/index.hbs | 1 - .../components/user-status-test.js | 28 +------------------ 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/app/components/user-status.hbs b/app/components/user-status.hbs index 0c998c10..fc5b898d 100644 --- a/app/components/user-status.hbs +++ b/app/components/user-status.hbs @@ -27,7 +27,6 @@ {{#each this.currentUserStatus as |currentStatus|}} {{#if (eq @status currentStatus.status)}} {{#if (eq currentStatus.status "OOO")}} - {{#if @dev}} - {{/if}} {{else}} {{#each currentStatus.otherAvailableStatus as |otherPossibleStatus|}}