def delete_book(): """Delete book by book id and report success or failure""" book_id = ui.ask_for_book_id() if datastore.delete_book(book_id): ui.message('Successfully deleted') else: ui.message('Book id not found in database')
def del_book(): '''deleting book from list based on id''' book_id = ui.ask_for_book_id() if datastore.delete_book(book_id): ui.message('BOOK REMOVED FROM DATABASE') else: ui.message('Book not found, please try again.')
def delete_book(): ''' Get book_id from user, delete book if found ''' book_id = ui.ask_for_book_id() if datastore.delete_book(book_id): ui.message('Successfully deleted') else: ui.message('Book id not found in database')
def del_book(): '''Get info from user, delete selected book if exists, display result''' book_id = ui.ask_for_book_id() if datastore.delete_book(book_id): ui.message('Book deleted') else: ui.message('Book id not found in database')
def edit_books(): ''' Search for book by ID, notify if update successful ''' book_id = ui.ask_for_book_id() if datastore.edit_book(book_id): ui.message('Successfully updated') else: ui.message('The book was NOT found')
def delete_book(): '''Get book id from user, delete selected book if ''' book_id = ui.ask_for_book_id() if datastore.delete_book(book_id): ui.message('Book deleted') else: ui.message('Book id not found in database')
def edit_book(): '''search book by id and edit author and title''' book_id = ui.ask_for_book_id() if datastore.edit_book(book_id): ui.message('Book\'s author and title Successfully edited') else: ui.message('Book not found in the database.')
def delete(): ''' Ask user input for book id, remove book from db if deleted, show message if action completed ''' id = ui.ask_for_book_id() for book in datastore.book_list: if book.id == id: datastore.book_list.remove(book) ui.message("Successfully deleted.")
def remove_unread(): '''Fetch and remove book from wishlist''' book_id = ui.ask_for_book_id() for book in datastore.book_list: if book_id == book_id and book.read == False: datamanipulation.remove_book(book_id)
def book_read(): ''' Get choice from user, edit datastore, display success/error''' book_id = ui.ask_for_book_id() if datastore.set_read(book_id, True): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def delete_book(): # users ui to check and see if the book is in the system book_id = ui.ask_for_book_id() # if statement to give user feedback about results of deletion attempt if datastore.delete_book(book_id, True): ui.message('Successfully deleted') else: ui.message('Book id not found in database')
def edit_book(): '''Get choice from user, edit a book's Title or Author''' book_id = ui.ask_for_book_id() new_info = ui.get_new_book_info() if datastore.edit_book(book_id, new_info): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def change_book_info(): ''' to change information about a book ''' # uses ui to check and see if the book is in the system book_id = ui.ask_for_book_id() # if statment to give user feed back about results if datastore.edit_book(book_id): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def book_read(): ''' Get choice from user, edit datastore, display success/error''' # uses ui to check and see if the book is in the system book_id = ui.ask_for_book_id() # if statment to give user feed back about results if datastore.set_read(book_id, True): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def update_record(): ''' Get choice from user, edit datastore, display success/error''' p_id = ui.ask_for_book_id() new_person = ui.get_new_record_info() if datastore.update_record(p_id, new_person): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def edit(): ''' Get book id from user, search for id, ask for new values, append ''' id = ui.ask_for_book_id() to_edit = ui.ask_what_to_edit() new_value = ui.get_new_value() for book in datastore.book_list: if book.id == id: read = book.read title = book.title author = book.author if to_edit == 'author': datastore.book_list.remove(book) datastore.book_list.append(Book(title, new_value, read, id)) elif to_edit == 'title': datastore.book_list.remove(book) datastore.book_list.append(Book(new_value, author, read, id)) ui.message("Successfully updated.")
def book_read(): ''' Get choice from user, edit datastore, display success/error''' book_id = ui.ask_for_book_id() rating = '' while rating not in range(1, 5): try: rating = int(input('Please enter a rating low (1) to high (5):')) if rating not in range(1, 5): ui.message('Rating is not in range, please try again') except ValueError: ui.message('Please enter a valid integer') rating = ('*' * rating) if datastore.set_read(book_id, True): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def book_read(): ''' Get choice from user, edit datastore, display success/error''' book_id = ui.ask_for_book_id() rating = '' while rating not in range(1, 5): try: rating = int( input("How many stars do you give this book? (1-5): ")) if rating not in range(1, 5): print('Number not within valid range.') except ValueError: print('Please enter a valid integer') rating = ('*' * rating) if datastore.set_read(book_id, rating): ui.message('Successfully updated') else: ui.message('Book id not found in database')
def edit_book(): """Get book id from user, edit book title or author, display success/error message""" book_id = ui.ask_for_book_id() if datastore.is_book(book_id): #does the book exist? option = ui.edit_book_info() if option == '1': title = datastore.get_title(book_id) new_title = ui.get_edit_info(option, title) datastore.set_title(book_id, new_title) ui.message('Book title has been changed') elif option == '2': author = datastore.get_author(book_id) new_author = ui.get_edit_info(option, author) datastore.set_author(book_id, new_author) ui.message('Book author has been changed') else: return else: ui.message('Book id not found in database')
def book_read(): ''' Get choice from user, edit datastore, display success/error, get decision for re-read''' book_id = ui.ask_for_book_id() book_rating = ui.ask_for_book_rating() if datastore.set_read(book_id, book_rating): ui.message('Successfully updated') while True: againWish = input( "\nQuick Question..\nDo you want to add this book back into your wishlist for future reading? 'y'es or 'n'o " ).strip().lower() if againWish == "y": new_book() print("*Successfully Added to wishlist*\n") break elif againWish != "y": break else: ui.message('Book id not found in database')
def edit_book(): ''' Get book_id from user, edit book if found ''' book_id = ui.ask_for_book_id() if datastore.edit_book(book_id): ui.message('Successfully edited')