Skip to content

Commit

Permalink
refactor: improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Sep 22, 2023
1 parent e98f00d commit b3b9ef6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getCompleteStateForWorkContext = (
archive: EntityState<Task>,
): {
completeStateForWorkContext: EntityState<Task>;
unarchivedIds: string[];
nonArchiveTaskIds: string[];
} => {
const wid = workContext.id;

Expand All @@ -22,7 +22,7 @@ export const getCompleteStateForWorkContext = (
...taskState.entities,
},
},
unarchivedIds: taskState.ids as string[],
nonArchiveTaskIds: taskState.ids as string[],
};
}

Expand All @@ -47,7 +47,7 @@ export const getCompleteStateForWorkContext = (
...archivedEntities,
},
},
unarchivedIds,
nonArchiveTaskIds: unarchivedIds,
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/features/worklog/worklog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h3 class="week-title mat-h4">
<td class="actions">
<button
(click)="restoreTask(logEntry.task);"
*ngIf="!logEntry.task?.parentId && !logEntry.isNoRestore"
*ngIf="!logEntry.task?.parentId && !logEntry.isNonArchiveTask"
[title]="T.F.WORKLOG.CMP.RESTORE_TASK_FROM_ARCHIVE|translate"
aria-label="restore"
color=""
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/worklog/worklog.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface WorklogDataForDay {
timeSpent: number;
task: WorklogTask;
parentId: string;
isNoRestore?: boolean;
isNonArchiveTask?: boolean;
}

export interface WorklogDay {
Expand Down
18 changes: 6 additions & 12 deletions src/app/features/worklog/worklog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,8 @@ export class WorklogService {
createEmptyEntity();

// console.time('calcTime');
const { completeStateForWorkContext, unarchivedIds } = getCompleteStateForWorkContext(
workContext,
taskState,
archive,
);
const { completeStateForWorkContext, nonArchiveTaskIds } =
getCompleteStateForWorkContext(workContext, taskState, archive);
// console.timeEnd('calcTime');

const startEnd = {
Expand All @@ -234,7 +231,7 @@ export class WorklogService {
if (completeStateForWorkContext) {
const { worklog, totalTimeSpent } = mapArchiveToWorklog(
completeStateForWorkContext,
unarchivedIds,
nonArchiveTaskIds,
startEnd,
this._dateAdapter.getFirstDayOfWeek(),
);
Expand All @@ -259,11 +256,8 @@ export class WorklogService {
createEmptyEntity();

// console.time('calcTime');
const { completeStateForWorkContext, unarchivedIds } = getCompleteStateForWorkContext(
workContext,
taskState,
archive,
);
const { completeStateForWorkContext, nonArchiveTaskIds } =
getCompleteStateForWorkContext(workContext, taskState, archive);
// console.timeEnd('calcTime');

const startEnd = {
Expand All @@ -274,7 +268,7 @@ export class WorklogService {
if (completeStateForWorkContext) {
return mapArchiveToWorklogWeeks(
completeStateForWorkContext,
unarchivedIds,
nonArchiveTaskIds,
startEnd,
this._dateAdapter.getFirstDayOfWeek(),
);
Expand Down

0 comments on commit b3b9ef6

Please sign in to comment.