当前位置: 首页>>代码示例>>Python>>正文


Python FirebasePusher.updateEvent方法代码示例

本文整理汇总了Python中helpers.firebase.firebase_pusher.FirebasePusher.updateEvent方法的典型用法代码示例。如果您正苦于以下问题:Python FirebasePusher.updateEvent方法的具体用法?Python FirebasePusher.updateEvent怎么用?Python FirebasePusher.updateEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helpers.firebase.firebase_pusher.FirebasePusher的用法示例。


在下文中一共展示了FirebasePusher.updateEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updateEvent [as 别名]
    def post(self):
        self._require_admin()
        event_key = self.request.get('event_key')
        matches_csv = self.request.get('matches_csv')
        matches = OffseasonMatchesParser.parse(matches_csv)

        event = Event.get_by_id(event_key)
        matches = [Match(
            id=Match.renderKeyName(
                event.key.id(),
                match.get("comp_level", None),
                match.get("set_number", 0),
                match.get("match_number", 0)),
            event=event.key,
            game=Match.FRC_GAMES_BY_YEAR.get(event.year, "frc_unknown"),
            set_number=match.get("set_number", 0),
            match_number=match.get("match_number", 0),
            comp_level=match.get("comp_level", None),
            team_key_names=match.get("team_key_names", None),
            alliances_json=match.get("alliances_json", None)
            )
            for match in matches]

        new_matches = MatchManipulator.createOrUpdate(matches)
        try:
            last_matches = MatchHelper.recentMatches(new_matches, 1)
            upcoming_matches = MatchHelper.upcomingMatches(new_matches, 8)
        except:
            logging.warning("Computing last/upcoming matches for Firebase failed!")
        try:
            FirebasePusher.updateEvent(event, last_matches, upcoming_matches)
        except:
            logging.warning("Enqueuing Firebase push failed!")

        self.redirect('/admin/event/{}'.format(event_key))
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:37,代码来源:admin_match_controller.py

示例2: get

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updateEvent [as 别名]
    def get(self, event_key):
        df = DatafeedUsfirst()

        event = Event.get_by_id(event_key)
        new_matches = MatchManipulator.createOrUpdate(df.getMatches(event))

        try:
            last_matches = MatchHelper.recentMatches(new_matches, 1)
            upcoming_matches = MatchHelper.upcomingMatches(new_matches, 8)
        except:
            logging.warning("Computing last/upcoming matches for Firebase failed!")
        try:
            FirebasePusher.updateEvent(event, last_matches, upcoming_matches)
        except:
            logging.warning("Enqueuing Firebase push failed!")

        template_values = {
            'matches': new_matches,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_matches_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:24,代码来源:datafeed_controller.py


注:本文中的helpers.firebase.firebase_pusher.FirebasePusher.updateEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。