def games_all():
        conn = db.get_db()
        cursor = conn.cursor()

        games = db.find_all(models.Game, cursor)
        game_dicts = [game.__dict__ for game in games]
        return json.dumps(game_dicts, default = str)
Example #2
0
    def venues():
        conn = db.get_db()
        cursor = conn.cursor()

        venues = db.find_all(models.Venue, cursor)
        venue_dicts = [venue.__dict__ for venue in venues]
        return json.dumps(venue_dicts, default=str)
    def incidents():
        conn = db.get_db()
        cursor = conn.cursor()

        incidents = db.find_all(models.Incident, cursor)
        incident_dicts = [incident.__dict__ for incident in incidents]
        return json.dumps(incident_dicts, default=str)
Example #4
0
def test_find_all(build_categories):
    categories = db.find_all(models.Category, test_cursor)
    assert [category.name
            for category in categories] == ['Taco Places', 'Asian Fusion']
 def games_with_earnings_ratings():
     conn = db.get_db()
     cursor = conn.cursor()
     ratings = db.find_all(models.Rating, cursor)
     ratings_dicts = [rating.to_json(cursor) for rating in ratings]
     return json.dumps(ratings_dicts, default = str)
 def search(self, params, cursor):
     if not params: return db.find_all(Earnings, cursor)
     query, search_tuple = self.search_clause(params)
     cursor.execute(query, search_tuple)
     records = cursor.fetchall()
     return db.build_from_records(Earnings, records)
 def search(self, params, cursor):
     if not params: return db.find_all(Venue, cursor)
     search_clause, search_tuple = self.search_clause(params)
     cursor.execute(search_clause, search_tuple)
     records = cursor.fetchall()
     return db.build_from_records(Venue, records)