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


Python FirebasePusher.updated_event方法代码示例

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


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

示例1: post

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updated_event [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]

        try:
            FirebasePusher.updated_event(event.key_name)
        except:
            logging.warning("Enqueuing Firebase push failed!")

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

示例2: get

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

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

        if new_matches:
            for match in new_matches:
                if hasattr(match, 'dirty') and match.dirty:
                    # Enqueue push notification
                    try:
                        FirebasePusher.updated_event(event.key_name)
                    except:
                        logging.warning("Enqueuing Firebase push failed!")
                    # Enqueue task to calculate matchstats
                    taskqueue.add(
                            url='/tasks/math/do/event_matchstats/' + event.key_name,
                            method='GET')
                    break


        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:quintessentiallyunathoritative,项目名称:the-blue-alliance,代码行数:29,代码来源:datafeed_controller.py

示例3: postUpdateHook

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updated_event [as 别名]
    def postUpdateHook(cls, matches):
        '''
        To run after the match has been updated.
        Send push notifications to subscribed users
        Only if the match is part of an active event
        '''
        for match in matches:
            if match.event.get().now:
                logging.info("Sending push notifications for "+match.key_name)
                try:
                    GCMMessageHelper.send_match_score_update(match)
                except exception:
                    logging.error("Error sending match updates: "+str(exception))

        '''
        Enqueue firebase push
        '''
        if matches:
            event_key = matches[0].event.id()
            try:
                FirebasePusher.updated_event(event_key)
            except Exception:
                logging.warning("Enqueuing Firebase push failed!")

            # Enqueue task to calculate matchstats
            taskqueue.add(
                    url='/tasks/math/do/event_matchstats/' + event_key,
                    method='GET')
开发者ID:dewdn2,项目名称:the-blue-alliance,代码行数:30,代码来源:match_manipulator.py

示例4: postUpdateHook

# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updated_event [as 别名]
    def postUpdateHook(cls, matches):
        """
        To run after models have been updated
        """
        if matches:
            event_key = matches[0].event.id()
            try:
                FirebasePusher.updated_event(event_key)
            except Exception:
                logging.warning("Enqueuing Firebase push failed!")

            # Enqueue task to calculate matchstats
            taskqueue.add(
                    url='/tasks/math/do/event_matchstats/' + event_key,
                    method='GET')
开发者ID:tindleroot,项目名称:the-blue-alliance,代码行数:17,代码来源:match_manipulator.py


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