@hmcts/ccd-case-ui-toolkit 7.0.29-move-file-path-fix → 7.0.29-task-comp-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8514,6 +8514,7 @@ class WorkAllocationService {
8514
8514
  if (!this.isWAEnabled()) {
8515
8515
  return of(null);
8516
8516
  }
8517
+ console.log(`completeTask: completing ${taskId}`);
8517
8518
  const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
8518
8519
  return this.http
8519
8520
  .post(url, {})
@@ -20959,8 +20960,7 @@ class CaseFileViewFolderSelectorComponent {
20959
20960
  return [];
20960
20961
  }
20961
20962
  containsDocument(cat, document) {
20962
- if (cat.documents.findIndex((doc) => (doc.document_binary_url === document.document_binary_url)
20963
- && (doc.attribute_path === document.attribute_path)) > -1) {
20963
+ if (cat.documents.findIndex((doc) => doc.document_binary_url === document.document_binary_url) > -1) {
20964
20964
  return [cat.category_id];
20965
20965
  }
20966
20966
  for (const c of cat.sub_categories) {
@@ -32139,25 +32139,22 @@ class EventStartGuard {
32139
32139
  const caseId = route.params['cid'];
32140
32140
  const eventId = route.params['eid'];
32141
32141
  const taskId = route.queryParams['tid'];
32142
- // TODO: NavigationExtras should be used once Angular upgrade changes have been incorporated
32143
- const isComplete = route.queryParams['isComplete'];
32144
32142
  const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
32145
32143
  if (caseInfoStr) {
32146
32144
  const caseInfo = JSON.parse(caseInfoStr);
32147
32145
  if (caseInfo && caseInfo.cid === caseId) {
32148
- if (isComplete) {
32149
- return of(true);
32150
- }
32151
32146
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, caseInfo.caseType, caseInfo.jurisdiction).pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId)));
32152
32147
  }
32153
32148
  }
32154
32149
  return of(false);
32155
32150
  }
32156
32151
  checkTaskInEventNotRequired(payload, caseId, taskId) {
32152
+ console.log('checkTaskInEventNotRequired: start');
32157
32153
  if (!payload || !payload.tasks) {
32158
32154
  return true;
32159
32155
  }
32160
32156
  const taskNumber = payload.tasks.length;
32157
+ console.log(`checkTaskInEventNotRequired: found ${taskNumber} tasks`);
32161
32158
  if (taskNumber === 0) {
32162
32159
  // if there are no tasks just carry on
32163
32160
  return true;
@@ -32166,11 +32163,13 @@ class EventStartGuard {
32166
32163
  const userInfoStr = this.sessionStorageService.getItem('userDetails');
32167
32164
  const userInfo = JSON.parse(userInfoStr);
32168
32165
  const tasksAssignedToUser = payload.tasks.filter(x => x.task_state !== 'unassigned' && x.assignee === userInfo.id || x.assignee === userInfo.uid);
32166
+ console.log(`checkTaskInEventNotRequired: ${tasksAssignedToUser} tasks assigned to user`);
32169
32167
  if (tasksAssignedToUser.length === 0) {
32170
32168
  // if no tasks assigned to user carry on
32171
32169
  return true;
32172
32170
  }
32173
32171
  else if (tasksAssignedToUser.length > 1 && !taskId) {
32172
+ console.log(`checkTaskInEventNotRequired: more than one task assigned, taskId: ${taskId}`);
32174
32173
  // if more than one task assigned to the user then give multiple tasks error
32175
32174
  this.router.navigate([`/cases/case-details/${caseId}/multiple-tasks-exist`]);
32176
32175
  return false;
@@ -32183,26 +32182,30 @@ class EventStartGuard {
32183
32182
  else {
32184
32183
  task = tasksAssignedToUser[0];
32185
32184
  }
32185
+ console.log(`checkTaskInEventNotRequired: storing task ${task} in session`);
32186
32186
  // if one task assigned to user, allow user to complete event
32187
32187
  this.sessionStorageService.setItem('taskToComplete', JSON.stringify(task));
32188
32188
  return true;
32189
32189
  }
32190
32190
  }
32191
32191
  checkForTasks(payload, caseId, eventId, taskId) {
32192
- // Clear taskToComplete from session as we will be starting the process for new task
32193
- this.sessionStorageService.removeItem('taskToComplete');
32194
32192
  if (payload.task_required_for_event) {
32195
32193
  // There are some issues in EventTriggerResolver/CaseService and/or CCD for some events
32196
32194
  // which triggers the CanActivate guard again.
32197
32195
  // If event start is initiated again, then we do not need to perform state machine processing again.
32198
32196
  // https://tools.hmcts.net/jira/browse/EUI-5489
32199
32197
  if (this.router && this.router.url && this.router.url.includes('event-start')) {
32198
+ console.log(`checkForTasks: event-start again check is true: ${this.router.url} : taskId = ${taskId}`);
32200
32199
  return of(true);
32201
32200
  }
32202
32201
  this.router.navigate([`/cases/case-details/${caseId}/event-start`], { queryParams: { caseId, eventId, taskId } });
32203
32202
  return of(false);
32204
32203
  }
32205
32204
  else {
32205
+ // Clear taskToComplete from session as we will be starting the process for new task
32206
+ console.log(`Removing taskToComplete from session storage for case:event:task ${caseId}:${eventId}:${taskId}`);
32207
+ this.sessionStorageService.removeItem('taskToComplete');
32208
+ console.log("checkForTasks: no task required for event");
32206
32209
  return of(this.checkTaskInEventNotRequired(payload, caseId, taskId));
32207
32210
  }
32208
32211
  }
@@ -32343,10 +32346,12 @@ class EventStartStateMachineService {
32343
32346
  if (!task) {
32344
32347
  task = context.tasks[0];
32345
32348
  }
32349
+ const taskStr = JSON.stringify(task);
32350
+ console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
32346
32351
  // Store task to session
32347
- context.sessionStorageService.setItem('taskToComplete', JSON.stringify(task));
32352
+ context.sessionStorageService.setItem('taskToComplete', taskStr);
32348
32353
  // Allow user to perform the event
32349
- context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { queryParams: { isComplete: true }, relativeTo: context.route });
32354
+ context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
32350
32355
  }
32351
32356
  entryActionForStateMultipleTasksAssignedToUser(state, context) {
32352
32357
  // Trigger final state to complete processing of state machine