Exemple #1
0
 def get_by_leagues(self, p1_league_codes, p2_league_codes):
     p1_league_codes = p1_league_codes or CFNLeagueCache.all_league_codes()
     p2_league_codes = p2_league_codes or CFNLeagueCache.all_league_codes()
     for gvm in self.cached_vms:
         if gvm.bins_match(p1_league_codes, p2_league_codes):
             return gvm
     # else if no match
     new_global_view_model = GlobalViewModel(
         self.global_data,
         p1_league_codes,
         p2_league_codes,
     )
     self.cached_vms.append(new_global_view_model)
     return new_global_view_model
Exemple #2
0
 def get_by_leagues(self, p1_league_codes, p2_league_codes):
     p1_league_codes = p1_league_codes or CFNLeagueCache.all_league_codes()
     p2_league_codes = p2_league_codes or CFNLeagueCache.all_league_codes()
     for gvm in self.cached_vms:
         if gvm.bins_match(p1_league_codes, p2_league_codes):
             return gvm
     # else if no match
     new_global_view_model = GlobalViewModel(
         self.global_data,
         p1_league_codes,
         p2_league_codes,
     )
     self.cached_vms.append(new_global_view_model)
     return new_global_view_model
Exemple #3
0
    def __init__(
            self,
            global_data,
            p1_league_codes,
            p2_league_codes,
            ):
        self.p1_league_codes = set(p1_league_codes)
        self.p2_league_codes = set(p2_league_codes)
        player_data = global_data.get_player_data_by_bins(
            CFNLeagueCache.convert_leagues_to_bins(self.p1_league_codes),
            CFNLeagueCache.convert_leagues_to_bins(self.p2_league_codes),
        )
        super(GlobalViewModel, self).__init__(player_data)
        self._analyze_round_data()

        self.name = "CHARACTER MATCHUPS BY LEAGUE"
        self.updated_date = convert_dt_to_nyc(
            get_latest_player_updated_at()
        )
        self.total_match_count = self.data.game_count // 2

        self.character_order = list(map(
            CharacterViewModel, cfn_constants.CHARACTER_ORDER
        ))
        all_league_codes = CFNLeagueCache.all_league_codes()
        self.p1_all_leagues = self.p1_league_codes == all_league_codes
        self.p2_all_leagues = self.p2_league_codes == all_league_codes
Exemple #4
0
    def __init__(
        self,
        global_data,
        p1_league_codes,
        p2_league_codes,
    ):
        self.p1_league_codes = set(p1_league_codes)
        self.p2_league_codes = set(p2_league_codes)
        player_data = global_data.get_player_data_by_bins(
            CFNLeagueCache.convert_leagues_to_bins(self.p1_league_codes),
            CFNLeagueCache.convert_leagues_to_bins(self.p2_league_codes),
        )
        super(GlobalViewModel, self).__init__(player_data)
        self._analyze_round_data()

        self.name = "CHARACTER MATCHUPS BY LEAGUE"
        self.updated_date = convert_dt_to_nyc(get_latest_player_updated_at())
        self.total_match_count = self.data.game_count // 2

        self.character_order = list(
            map(CharacterViewModel, cfn_constants.CHARACTER_ORDER))
        all_league_codes = CFNLeagueCache.all_league_codes()
        self.p1_all_leagues = self.p1_league_codes == all_league_codes
        self.p2_all_leagues = self.p2_league_codes == all_league_codes