add start and end date in chapters list

This commit is contained in:
Francois G 2023-03-18 22:20:41 +01:00
parent a100c5e672
commit 005596f28f

View file

@ -34,6 +34,8 @@ public class ChapterList implements Response {
JSONObject chapterJSON = new JSONObject(); JSONObject chapterJSON = new JSONObject();
chapterJSON.put("id", chapter.getId()); chapterJSON.put("id", chapter.getId());
chapterJSON.put("name", chapter.getName()); chapterJSON.put("name", chapter.getName());
if (chapter.getStartDate() != null) chapterJSON.put("startDate", chapter.getStartDate());
if (chapter.getEndDate() != null) chapterJSON.put("endDate", chapter.getEndDate());
chaptersJSON.add(chapterJSON); chaptersJSON.add(chapterJSON);
} }
writer.write(chaptersJSON.toJSONString()); writer.write(chaptersJSON.toJSONString());