Skip to content

Commit

Permalink
Fix [#113] 홈뷰 isComplete response에 추가 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
geniusYoo authored Jul 16, 2024
2 parents 070c7b2 + 39290e0 commit 12e6626
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ public record TaskWithTaskTimer(
String name,
LocalDate startDate,
LocalDate endDate,
int targetTime
int targetTime,
boolean isComplete
) {
public static TaskWithTaskTimer of(Long id, String name, LocalDate startDate, LocalDate endDate, int targetTime) {
return new TaskWithTaskTimer(id, name, startDate, endDate, targetTime);
public static TaskWithTaskTimer of(Long id, String name, LocalDate startDate, LocalDate endDate, int targetTime, boolean isComplete) {
return new TaskWithTaskTimer(id, name, startDate, endDate, targetTime, isComplete);
}
public static TaskWithTaskTimer init(Long id, String name, LocalDate startDate, LocalDate endDate) {
return new TaskWithTaskTimer(id, name, startDate, endDate, 0);
public static TaskWithTaskTimer init(Long id, String name, LocalDate startDate, LocalDate endDate, boolean isComplete) {
return new TaskWithTaskTimer(id, name, startDate, endDate, 0, isComplete);
}
public static TaskWithTaskTimer ofByInit(TaskWithTaskTimer taskWithTaskTimer, int targetTime) {
return new TaskWithTaskTimer(taskWithTaskTimer.id(), taskWithTaskTimer.name(), taskWithTaskTimer.startDate, taskWithTaskTimer.endDate, targetTime);
public static TaskWithTaskTimer ofByInit(TaskWithTaskTimer taskWithTaskTimer, int targetTime, boolean isComplete) {
return new TaskWithTaskTimer(taskWithTaskTimer.id(), taskWithTaskTimer.name(), taskWithTaskTimer.startDate, taskWithTaskTimer.endDate, targetTime, isComplete);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<FilteredResourceResponse> getAllResources(LocalDate startDate, Local
// taskList 중, idxDate에 해당하면 Task List에 추가
if (taskService.isContains(task, idxDate)) {
// targetTime을 가져와서 세팅
taskWithTaskTimerList.add(TaskWithTaskTimer.ofByInit(task, taskTimerService.getTaskTimeByTaskId(3L, idxDate, task.id())));
taskWithTaskTimerList.add(TaskWithTaskTimer.ofByInit(task, taskTimerService.getTaskTimeByTaskId(3L, idxDate, task.id()), task.isComplete()));
}
}
target.categoryTaskLinkList().add(CategoryTaskLink.of(categoryTaskLink.categoryCheckResponse(), taskWithTaskTimerList));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ public List<CategoryTaskLink> getCategoryTaskByCategories(List<CategoryCheckResp
for (CategoryTask categoryTask : categoryTaskList) {
// 해당 categoryTask의 taskId로 task를 조회해서 taskList에 주입
Task task = taskService.getTaskById(categoryTask.getTaskId());
taskWithTaskTimerList.add(TaskWithTaskTimer.init(task.getId(), task.getName(), task.getStartDate(), task.getEndDate()));
taskWithTaskTimerList.add(TaskWithTaskTimer.init(task.getId(), task.getName(), task.getStartDate(), task.getEndDate(), task.getIsComplete()));
}
categoryTaskLinkList.add(CategoryTaskLink.of(category, taskWithTaskTimerList));
}
return categoryTaskLinkList;
}

public boolean isContains(CategoryCheckResponse categoryCheckResponse, LocalDate idxDate) {
if (categoryCheckResponse.endDate() == null) {

}
return (categoryCheckResponse.startDate().isBefore(idxDate) &&
categoryCheckResponse.endDate().isAfter(idxDate)) ||
categoryCheckResponse.startDate().equals(idxDate) ||
Expand Down

0 comments on commit 12e6626

Please sign in to comment.