Created
December 15, 2014 23:09
-
-
Save calindotgabriel/d8ea2aea90758d94e788 to your computer and use it in GitHub Desktop.
fp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_all_borrowed_books(self): | |
if not self.get_all(): | |
raise RepositoryException("No books saved.") | |
cl_book_links = self.get_all() | |
borrowed_books = [] | |
for link in cl_book_links: | |
link_book = link.get_book() | |
books_from_records = convert_bookrecord_to_books(borrowed_books) | |
if not occurs(link_book, books_from_records): | |
borrowed_books.append(BookRecord(link_book, 0)) | |
else: # book occurs | |
for borrowed_book in borrowed_books: | |
if borrowed_book.get_book() == link_book: | |
borrowed_book.inc_borrowed() | |
return borrowed_books |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment