Skip to content

Instantly share code, notes, and snippets.

@calindotgabriel
Created December 15, 2014 23:09
Show Gist options
  • Save calindotgabriel/d8ea2aea90758d94e788 to your computer and use it in GitHub Desktop.
Save calindotgabriel/d8ea2aea90758d94e788 to your computer and use it in GitHub Desktop.
fp
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