Skip to content

Commit

Permalink
refactor(Prerequisite): rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
arnolanglade committed Nov 10, 2023
1 parent 7b4008b commit 927a2d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/api/mikado-graph/mikado-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class Prerequisite {
);
}

childrenDone(): Prerequisite {
prerequisiteCanBeCommitted(): Prerequisite {
return new Prerequisite(
this.prerequisiteId,
this.label,
Expand All @@ -109,7 +109,7 @@ export class Prerequisite {
);
}

resetChildrenDone(): Prerequisite {
prerequisiteCannotBeCommitted(): Prerequisite {
return new Prerequisite(
this.prerequisiteId,
this.label,
Expand Down Expand Up @@ -257,7 +257,7 @@ export class MikadoGraph {

addPrerequisite(prerequisiteId: string, label: string, parentId?: string): void {
if (parentId) {
this.prerequisites = this.prerequisites.replace(parentId, (prerequisite) => prerequisite.resetChildrenDone());
this.prerequisites = this.prerequisites.replace(parentId, (prerequisite) => prerequisite.prerequisiteCannotBeCommitted());
}

this.prerequisites = this.prerequisites.add(Prerequisite.new(prerequisiteId, parentId ?? this.id.toString(), label));
Expand All @@ -277,7 +277,7 @@ export class MikadoGraph {
const prerequisite = this.prerequisites.find((p) => p.identifyBy(prerequisiteId));
const childrenPrerequisiteUnDone = this.prerequisites.find((p) => p.hasParent(prerequisite) && !p.hasStatus(Status.DONE));
if (!childrenPrerequisiteUnDone) {
this.prerequisites = this.prerequisites.replaceParent(prerequisite, (p) => p.childrenDone());
this.prerequisites = this.prerequisites.replaceParent(prerequisite, (p) => p.prerequisiteCanBeCommitted());
}
}

Expand Down

0 comments on commit 927a2d9

Please sign in to comment.