Skip to content

Commit

Permalink
Merge pull request #152 from Lin-Shuang-Shuang/branch-FixProjectRename
Browse files Browse the repository at this point in the history
Fix project renaming data loss issue
  • Loading branch information
Lin-Shuang-Shuang authored Apr 13, 2024
2 parents 9a04499 + 336a6c0 commit d8415fb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/seedu/address/model/project/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public void assignTeam(List<Member> team) {
this.team = team;
}

public void setComment(List<Comment> comments) {
this.comments = comments;
}

/**
* Sets the task status as complete
*/
Expand Down Expand Up @@ -285,6 +289,17 @@ public void addComment(Comment comment) {
public Project createEditedProject(Name newName) {
List<Task> newTaskList = new ArrayList<>(this.taskList);
Project newProject = new Project(newName, newTaskList);
newProject.setDeadline(this.deadlineDate);
newProject.setCategory(this.category);
newProject.assignTeam(this.team);
newProject.setComment(this.comments);

if (this.isCompleted()) {
newProject.setComplete();
} else {
newProject.setIncomplete();
}

return newProject;
}

Expand Down

0 comments on commit d8415fb

Please sign in to comment.