def fetch_candidate_items_for_category(city, category): search_results = candidate_yelp_ids_with_name(city, category) candidate_items = [] for yelp_id, item_name in search_results: item = Item( id=None, yelp_id=yelp_id, category=category.name, name=item_name, start_time="", end_time="" ) item.yelp_entry = db.sqlite.get_yelp_entry(yelp_id) candidate_items.append(item) return candidate_items
def fetch_new_item(location, category, start_time="", end_time="", coordinate_str=None, disallowed_yelp_ids=[]): """ If start_time, end_time not specified, callee must add these to Item! coordinate_str is for 'cll' param in yelp search query string Does not persist Item result to the database! """ yelp_id, item_name = best_yelp_id_with_name(location, category, coordinate_str=coordinate_str, disallowed_yelp_ids=disallowed_yelp_ids) item = Item( id=None, yelp_id=yelp_id, category=category.name, name=item_name, start_time=start_time, end_time=end_time ) item.yelp_entry = db.sqlite.get_yelp_entry(yelp_id) return item
def item_from_cursor(self, cursor, row): if row: item = Item(row[0], row[2], row[3], row[4], row[5], row[6]) item.yelp_entry = self.get_yelp_entry(item.yelp_id) return item return None