diff --git a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java index a60d082..ed57da3 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java @@ -25,11 +25,6 @@ */ private final HashMap nextTodoId = new HashMap<>(); -// private final BookManager bookManager; -// -// TodoManger(BookManager bookManager){ -// this.bookManager = bookManager; -// } /** * @@ -159,6 +154,7 @@ * @param month 月 * @param day 日 * @param title 追加するべきtodoのタイトル + * @return 新しいtodoのid */ public int addTodo(String accountId, int bookId, int year, int month, int day, String title){ if(!todos.containsKey(accountId)){ @@ -181,11 +177,11 @@ nextTodoId.put(accountBook, 0); } - int todoId = nextTodoId.get(accountBook); - Todo newTodo = new Todo(title, false, year, month, day, todoId); - todos.get(accountId).get(bookId).get(year).get(month).get(day).put(todoId, newTodo); - nextTodoId.put(accountBook, todoId + 1); - return todoId; + int newTodoId = nextTodoId.get(accountBook); + Todo newTodo = new Todo(title, false, year, month, day, newTodoId); + todos.get(accountId).get(bookId).get(year).get(month).get(day).put(newTodoId, newTodo); + nextTodoId.put(accountBook, newTodoId + 1); + return newTodoId; } /** @@ -194,6 +190,7 @@ * @param bookId 本のid * @param yearMonthDay 年月日を-で区切った文字列(yyyy-mm-dd) * @param title 追加したいtodoのタイトル + * @return 新しいtodoのid */ public int addTodo(String accountId, int bookId, String yearMonthDay, String title){ String[] yearMonthDays = yearMonthDay.split("-");