diff --git a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java index 002afb0..18913c6 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java @@ -47,10 +47,10 @@ } public Schedule addSchedule(String accountId, int year, int month, int day, String title, String startTime, String endTime, Integer bookId){ - if(bookId == null){ + if(bookId == null || bookId.equals(0)){ bookId = 0; } - else if(!bookManager.getBooks(accountId).containsKey(bookId) || bookId.equals(0))return null; + else if(!bookManager.getBooks(accountId).containsKey(bookId))return null; if(!schedules.containsKey(accountId)){ schedules.put(accountId, new HashMap<>()); @@ -99,10 +99,10 @@ //voidからintに変更 1で成功 -1でエラー処理 public int setSchedulesBookId(String accountId, int year, int month, int day, int scheduleId, Integer newBookId){ - if(newBookId == null){ + if(newBookId == null || newBookId.equals(0)){ newBookId = 0; } - else if(!bookManager.getBooks(accountId).containsKey(newBookId) || newBookId.equals(0))return -1; + else if(!bookManager.getBooks(accountId).containsKey(newBookId))return -1; schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setBookId(newBookId); return 1;