def __init__(self, person): self.person = person self.decks = person.decks self.hide_person = True self.cards = card.played_cards( 'person_id = {person_id}'.format(person_id=sqlescape(person.id))) self.only_played_cards = card.only_played_by(person.id) self.has_only_played_cards = len(self.only_played_cards) > 0
def __init__(self, person): self.person = person self.decks = person.decks self.hide_person = True self.cards = card.played_cards( 'd.person_id = {person_id}'.format(person_id=sqlescape(person.id))) self.only_played_cards = card.only_played_by(person.id) self.has_only_played_cards = len(self.only_played_cards) > 0 for record in person.head_to_head: record.show_record = True record.opp_url = url_for('person', person_id=record.opp_mtgo_username) self.show_head_to_head = len(person.head_to_head) > 0 self.tournament_organizer = self.person.name in [ host for series in tournaments.all_series_info() for host in series['hosts'] ]
def cards_api(): return return_json(cs.played_cards())
def test_played_cards_season() -> None: perf.test(lambda: card.played_cards(season_id=1), 0.5)
def test_played_cards_person() -> None: where = "d.person_id IN (SELECT id FROM person WHERE mtgo_username = '******')" perf.test(lambda: card.played_cards(where), 0.5)
def cards(): view = Cards(cs.played_cards(season_id=get_season_id())) return view.page()
def home(): view = Home(ns.load_news(max_items=10), ds.load_decks(limit='LIMIT 50'), cs.played_cards(season_id=get_season_id())) return view.page()
def cards(): view = Cards(cs.played_cards()) return view.page()