def new_user_full_setup(gr_user_id, user_id, goodreads_key): shelves = get_shelves(gr_user_id, goodreads_key) book_list = get_books_from_shelves(shelves, goodreads_key) # check if book in library; if not, add to library add_book_to_library(book_list) # add book to UserBook table add_userbook_to_userbooks(book_list, gr_user_id) # get subjects for all new books # subject_dict = fetch_google_books_categories() subject_dict2 = fetch_openlib_subject_info() # print len(subject_dict) print len(subject_dict2) # create new book_subjects for new books # create_book_subjects(subject_dict) create_book_subjects(subject_dict2) # generate recommendations rated, to_rate = set_up_data(user_id) generate_new_user_predictions(rated, to_rate, user_id) return "New User Setup Complete"
def bulk_user_add(user_ids): for gr_user_id in user_ids: print gr_user_id # get shelves shelves = get_shelves(gr_user_id) #get books from shelves book_list = get_books_from_shelves(shelves) # check if book in library; if not, add to library add_book_to_library(book_list)