def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read book.save()
def change_read(): book_id = ui.get_book_id() new_read = ui.get_read_value() try: store.set_book_read(book_id, new_read) ui.message('Updated.') except BookError as e: ui.message(e)
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read ui.message(f"You have {'read' if book.read else 'not read' } \"{book.title}\" by {book.author}") book.save()
def change_read(): try: book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read book.save() except: print('That book is not in the database!')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read book.save() if book.read: ui.message(f'You have read {book.title} by {book.author}') else: ui.message(f'You have not read {book.title} by {book.author}') if book: # book will be None if it's not found in db new_read = ui.get_read_value() book.read = new_read book.save() else: ui.message('Error: Book Not Found')
def change_read(): book_id = ui.get_book_id() try: book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read book.save() except UnboundLocalError as e: ui.message('Book not found \n')
def change_read(): book_id = ui.get_book_id() book = bookstore.get_book_by_id(book_id) if not book: ui.message('Book not found') return new_read = ui.get_read_value() book.read = new_read book.save()
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book: new_read = ui.get_read_value() book.read = new_read book.save() ui.message(f'{book.title} by {book.author} has been updated!') else: ui.message(f'No book with ID {book_id} exists.')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read if new_read: ui.message(f'\nConfirmation: You have read {book.title} by {book.author}\n') else: ui.message(f'\nConfirmation: You have not read {book.title} by {book.author}\n') book.save()
def change_read(): try: book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read book.save() print('It has been changed !') except: ui.message('Book not found')
def change_read(): try: book_id = ui.get_book_id() book = store.get_book_by_id(book_id) new_read = ui.get_read_value() book.read = new_read ui.message(f"You have {'read' if book.read else 'not read' } \"{book.title}\" by {book.author}") book.save() except: ui.message("A book with that ID does not exist in the database")
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book != None: new_read = ui.get_read_value(book) #added book variable to be passed to be able to grab the book.title book.read = new_read book.save() else: print('No book with that ID. Please try again.')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) # checking the object type if isinstance(book, Book): new_read = ui.get_read_value() book.read = new_read book.save() elif book == 'not found': create_menu()
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book: new_read = ui.get_read_value() book.read = new_read book.save() read_string = 'not ' if not book.read else '' print(f"\nYou have {read_string}read {book.title} by {book.author}\n") else: print(f'\nNo book with id: {book_id} found. Please try again.\n')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book != None: new_read = ui.get_read_value() book.read = new_read book.save() ui.display_book_change_message(book) else: ui.message('Book does not exist, please select \'Add book\' instead.')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book: new_read = ui.get_read_value() book.read = new_read read_status = 'have' if book.read else 'have not' ui.message(f'You {read_status} read {book.title} by {book.author}') book.save() else: print('Book not found')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book != None: new_read = ui.get_read_value() book.read = new_read book.save() if new_read: read_status = 'READ' else: read_status = 'NOT READ' ui.message(f'Read status changed to {read_status}')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) #If the book value is none the error message is printed if book == None: print('\nError: The book id is not in the database\n') else: new_read = ui.get_read_value() book.read = new_read book.save()
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book != None: new_read = ui.get_read_value() book.read = new_read book.save() if new_read == True: print("You have read ", book.title) else: print("You have not read ", book.title)
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book is not None: new_read = ui.get_read_value() book.read = new_read book.save() if new_read is False: print("You have not read " + book.title) else: print("You have read " + book.title + " by " + book.author)
def change_read(): """ gets book if then changes it to read or unread then saves it""" book_id = ui.get_book_id() #gets book id book = store.get_book_by_id(book_id) #checks to see if ID in the database if book is not None: new_read = ui.get_read_value( book ) #added book so book title and author is passed when confirmed book.read = new_read book.save() else: print('\nThe book ID you have entered is NOT in the database\n')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) #validation to check if the book exists if book == None: print('Book not found') else: new_read = ui.get_read_value() book.read = new_read book.save() print("you have changed the 'read or unread' status of this book. ")
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if (book != "None"): new_read = ui.get_read_value() book.read = new_read if book.read == True: ui.message(f'You have read {book.title} by {book.author}.') else: ui.message(f'You have not read {book.title} by {book.author}.') book.save() else: ui.message("Book not found.")
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book is None: print("\n**Error: Book not found in database.**\n") return else: new_read = ui.get_read_value() if (new_read): print(f"\nYou have read {book.title} by {book.author}.\n") else: print(f"\nYou have not read {book.title} by {book.author}.\n") book.read = new_read book.save()
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book: new_read = ui.get_read_value() book.read = new_read book.save() if new_read: print(f'You have read {book.title} by {book.author}') else: print(f'You have not read {book.title} by {book.author}') else: print('Error: book not found')
def change_read(): book_id = ui.get_book_id() book = store.get_book_by_id(book_id) if book: # If book ID found in db new_read = ui.get_read_value() # if else statement to determine what the state the book is in if new_read == False: read_var = '"not read"' else: read_var = '"read"' book.read = new_read book.save() print('Book status has changed to', read_var) else: # If book ID not found in db print('That book is not found.') option = input('Return to main menu? Y for main menu. ').upper() if option == 'Y': print() else: change_read() # restarts function for book ID input
def test_get_read_value_validates(self, mock_input): self.assertTrue(ui.get_read_value())
def test_get_read_value_unread(self, mock_input): self.assertFalse(ui.get_read_value())
def change_read(): book_id = ui.get_book_id() new_read = ui.get_read_value() store.set_book_read(book_id, new_read)