Пример #1
0
 def reload(self):
     """マスターデータをリロード.
     """
     now_diff = OSAUtil.get_now_diff()
     MasterData.incrementEditCacheVersion()
     rediscache.flush_all()
     OSAUtil.get_cache_client().flush()
     if settings_sub.IS_DEV:
         OSAUtil.set_now_diff(now_diff)
Пример #2
0
    def setUp(self):
        now = OSAUtil.get_now()
        testtime = BackendApi.to_cabaretclub_section_starttime(
            now) + datetime.timedelta(seconds=500)
        OSAUtil.set_now_diff(int((testtime - now).total_seconds()))

        ua_type = Defines.CabaClubEventUAType.LIVEN_UP
        # ユーザーを用意.
        self.__player = self.create_dummy(DummyType.PLAYER)
        # 店舗を用意.
        cabaclub_dummy = self.setUpCabaclub(self.__player, now=testtime)
        self.__cabaclub_dummy = cabaclub_dummy
        self.__storemaster = cabaclub_dummy.stores[ua_type]
        self.__eventmaster = cabaclub_dummy.events[ua_type]
        self.__exec_cnt = 3
        # キャストを配置しておく.
        self.create_dummy(DummyType.CABA_CLUB_CAST_PLAYER_DATA,
                          self.__player.id, self.__storemaster.id,
                          cabaclub_dummy.cardlist)
        # 前回更新時間を戻しておく.
        storeplayerdata = cabaclub_dummy.storeplayerdata[ua_type]
        storeplayerdata.is_open = True
        storeplayerdata.etime = cabaclub_dummy.now - datetime.timedelta(
            seconds=Defines.CABARETCLUB_STORE_EVENT_INTERVAL)
        storeplayerdata.utime = cabaclub_dummy.now - datetime.timedelta(
            seconds=self.__storemaster.customer_interval * self.__exec_cnt)
        storeplayerdata.save()
        self.__storeplayerdata = storeplayerdata

        # 時間進行実行.
        def tr():
            model_mgr = ModelRequestMgr()
            BackendApi.tr_cabaclubstore_advance_the_time(
                model_mgr, self.__player.id, self.__storemaster,
                cabaclub_dummy.now)
            model_mgr.write_all()
            model_mgr.write_end()

        db_util.run_in_transaction(tr)
Пример #3
0
 def finish(self):
     OSAUtil.set_now_diff(0)