Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import {TaskEventOutcome} from './task-event-outcome';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface FinishTaskEventOutcome extends TaskEventOutcome {

isTaskStillExecutable?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@ export interface Task {
delegateTitle?: string;
immediateData?: Array<ImmediateData>;
assignedUserPolicy?: AssignedUserPolicy;

isStillExecutable?: boolean;
Comment on lines +73 to +74
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

Verify naming consistency across interfaces.

The property is named isStillExecutable here, but isTaskStillExecutable in FinishTaskEventOutcome. While the difference might be intentional (Task context vs Event context), consider whether consistent naming would improve clarity.

Run the following script to check for any other references to these properties:


🏁 Script executed:

#!/bin/bash
# Description: Check usage of the executable state properties across the codebase

echo "=== Checking for isStillExecutable references ==="
rg -n "isStillExecutable" --type=ts

echo -e "\n=== Checking for isTaskStillExecutable references ==="
rg -n "isTaskStillExecutable" --type=ts

Length of output: 1153


Align naming of executable flag across interfaces.
Task interface uses isStillExecutable but FinishTaskEventOutcome defines isTaskStillExecutable. Consider unifying to a single property name (e.g. isStillExecutable) for clarity.

🤖 Prompt for AI Agents
In projects/netgrif-components-core/src/lib/resources/interface/task.ts around
lines 73-74, the Task interface declares the flag as isStillExecutable while
related FinishTaskEventOutcome uses isTaskStillExecutable; rename the latter to
isStillExecutable so both interfaces use the exact same property name, then
update all references/usages, type imports, serializers/deserializers, and tests
to the new name to ensure consistency and no unresolved type or runtime errors.

}
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ export abstract class TaskContentService implements OnDestroy {
/**
* Clears the assignee, start date and finish date from the managed Task.
*/
public updateStateData(eventOutcome: TaskEventOutcome): void {
public updateStateData(eventOutcome: TaskEventOutcome, isStillExecutable: boolean = true): void {
if (this._task) {
this._task.user = eventOutcome.task.user;
this._task.startDate = eventOutcome.task.startDate;
this._task.finishDate = eventOutcome.task.finishDate;
this._task.isStillExecutable = isStillExecutable;
}
}

Expand All @@ -235,7 +236,7 @@ export abstract class TaskContentService implements OnDestroy {
}

protected updateField(chFields: ChangedFields, field: DataField<any>, frontendActions: Change, referenced: boolean = false): void {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF) {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Simplify the conditional logic.

The double negation !! is redundant in this boolean context. The condition can be simplified for better readability.

Apply this diff to simplify the condition:

-        if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
+        if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && this._task?.isStillExecutable !== false) {

This alternative reads more clearly: "reload task data unless explicitly marked as not executable."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF && (!!this._task?.isStillExecutable || this._task?.isStillExecutable === undefined)) {
if (this._fieldConverterService.resolveType(field) === FieldTypeResource.TASK_REF
&& this._task?.isStillExecutable !== false) {
🤖 Prompt for AI Agents
In
projects/netgrif-components-core/src/lib/task-content/services/task-content.service.ts
around line 239, simplify the conditional by removing the redundant double
negation; change the right-hand check to test that the task is not explicitly
false (e.g., this._task?.isStillExecutable !== false) so the whole condition
becomes: ensure the field type is TASK_REF and the task is not explicitly marked
as not executable, which reads as "reload task data unless explicitly marked as
not executable."

this._taskDataReloadRequest$.next(frontendActions ? frontendActions : undefined);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ export class FinishTaskService extends TaskHandlingService {
}

if (outcomeResource.success) {
this._taskContentService.updateStateData(outcomeResource.outcome as FinishTaskEventOutcome);
const outcome = outcomeResource.outcome as FinishTaskEventOutcome
this._taskContentService.updateStateData(outcome, outcome.isTaskStillExecutable);
const changedFieldsMap: ChangedFieldsMap = this._eventService
.parseChangedFieldsFromOutcomeTree(outcomeResource.outcome);
if (!!changedFieldsMap) {
Expand Down
Loading