diff --git a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java index c118062..a60d082 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java @@ -158,7 +158,7 @@ * @param year 年 * @param month 月 * @param day 日 - * @param todo 追加するべきtodo + * @param title 追加するべきtodoのタイトル */ public int addTodo(String accountId, int bookId, int year, int month, int day, String title){ if(!todos.containsKey(accountId)){ @@ -181,11 +181,11 @@ nextTodoId.put(accountBook, 0); } - int tmp = nextTodoId.get(accountBook); -// Todo newTodo = new Todo(title, ); - todos.get(accountId).get(bookId).get(year).get(month).get(day).put(tmp, todo); - nextTodoId.put(accountBook, tmp + 1); - return tmp; + 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; } /** @@ -193,14 +193,14 @@ * @param accountId アカウントのid * @param bookId 本のid * @param yearMonthDay 年月日を-で区切った文字列(yyyy-mm-dd) - * @param todo 追加したいtodo + * @param title 追加したいtodoのタイトル */ - public int addTodo(String accountId, int bookId, String yearMonthDay, Todo todo){ + public int addTodo(String accountId, int bookId, String yearMonthDay, String title){ String[] yearMonthDays = yearMonthDay.split("-"); int year = Integer.parseInt(yearMonthDays[0]); int month = Integer.parseInt(yearMonthDays[1]); int day = Integer.parseInt(yearMonthDays[2]); - return addTodo(accountId, bookId, year, month, day, todo); + return addTodo(accountId, bookId, year, month, day, title); } /**