Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(reminder): change return type for method getBooksForLesson and ge…
Browse files Browse the repository at this point in the history
…tLessonsForBook, both now return ReminderForLesson
  • Loading branch information
AndreaBrighi committed Jul 11, 2023
1 parent e4a1575 commit 25f2f78
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ interface Reminder {
* Get books for lesson.
*
* @param event event.
* @return books for lesson.
* @return the reminder for lesson.
*/
fun getBooksForLesson(event: EventAdapter.CalendarEvent): Set<String>
fun getBooksForLesson(event: EventAdapter.CalendarEvent): Set<ReminderForLesson>

/**
* Get lessons for book.
*
* @param isbn isbn.
* @return lessons for book.
* @return the reminder for the book.
*/
fun getLessonsForBook(isbn: String): Set<EventAdapter.CalendarEvent>
fun getLessonsForBook(isbn: String): Set<ReminderForLesson>

/**
* Get books for lesson in date.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import java.time.LocalDate

/**
* Reminder implementation
*
* @param booksForLesson map of books for lesson
* @param lessonsForBook map of lessons for book
*/
data class ReminderImpl(
val booksForLesson: Map<EventAdapter.CalendarEvent, Set<ReminderForLesson>> = mapOf(),
Expand Down Expand Up @@ -109,12 +112,12 @@ data class ReminderImpl(
)
}

override fun getBooksForLesson(event: EventAdapter.CalendarEvent): Set<String> {
return booksForLesson[event]?.map { it.isbn }?.toSet() ?: setOf()
override fun getBooksForLesson(event: EventAdapter.CalendarEvent): Set<ReminderForLesson> {
return booksForLesson[event]?.toSet() ?: setOf()
}

override fun getLessonsForBook(isbn: String): Set<EventAdapter.Lesson> {
return lessonsForBook[isbn]?.map { it.lesson }?.toSet() ?: setOf()
override fun getLessonsForBook(isbn: String): Set<ReminderForLesson> {
return lessonsForBook[isbn]?.toSet() ?: setOf()
}

override fun getBooksForLessonInDate(event: EventAdapter.CalendarEvent, date: LocalDate): Set<String> {
Expand Down

0 comments on commit 25f2f78

Please sign in to comment.