Пример #1
0
    def updateCachedStats(self):
        """
		Update all cached stats for this token

		:return:
		"""
        stats = userUtils.getUserStats(self.userID, self.gameMode)
        stats_relax = userUtils.getUserStatsRx(self.userID, self.gameMode)
        log.debug(str(stats))

        if stats is None:
            log.warning("Stats query returned None")
            return
        if self.relaxing:
            self.gameRank = stats_relax["gameRank"]
            self.pp = stats_relax["pp"]
            self.rankedScore = stats_relax["rankedScore"]
            self.accuracy = stats_relax["accuracy"] / 100
            self.playcount = stats_relax["playcount"]
            self.totalScore = stats_relax["totalScore"]
        else:
            self.gameRank = stats["gameRank"]
            self.pp = stats["pp"]
            self.rankedScore = stats["rankedScore"]
            self.accuracy = stats["accuracy"] / 100
            self.playcount = stats["playcount"]
            self.totalScore = stats["totalScore"]
Пример #2
0
	def updateCachedStats(self):
		"""
		Update all cached stats for this token

		:return:
		"""
		
		if self.relaxing:
			stats_relax = userUtils.getUserStatsRx(self.userID, self.gameMode)
			
			self.gameRank = stats_relax["gameRank"]
			self.pp = stats_relax["pp"]
			self.rankedScore = stats_relax["rankedScore"]
			self.accuracy = stats_relax["accuracy"]/100
			self.playcount = stats_relax["playcount"]
			self.totalScore = stats_relax["totalScore"]

		elif self.autopiloting:
			stats_ap = userUtils.getUserStatsAP(self.userID, self.gameMode)

			self.gameRank = stats_ap["gameRank"]
			self.pp = stats_ap["pp"]
			self.rankedScore = stats_ap["rankedScore"]
			self.accuracy = stats_ap["accuracy"]/100
			self.playcount = stats_ap["playcount"]
			self.totalScore = stats_ap["totalScore"]
		else:
			stats = userUtils.getUserStats(self.userID, self.gameMode)

			self.gameRank = stats["gameRank"]
			self.pp = stats["pp"]
			self.rankedScore = stats["rankedScore"]
			self.accuracy = stats["accuracy"]/100
			self.playcount = stats["playcount"]
			self.totalScore = stats["totalScore"]
Пример #3
0
	def update(self, userID, gameMode, data = None):
		"""
		Update cached user stats in redis with new values

		:param userID: userID
		:param gameMode: game mode number
		:param data: data to cache. Optional. If not passed, will get from db
		:return:
		"""
		if data is None:
			data = {}
		if len(data) == 0:
			data = userUtils.getUserStatsRx(userID, gameMode)
		log.debug("userStatsCacheRX set {}".format(data))
		glob.redis.set("lets:user_stats_cache_relax:{}:{}".format(gameMode, userID), json.dumps(data), 1800)
Пример #4
0
    def updateCachedStats(self):
        """
		Update all cached stats for this token

		:return:
		"""
        stats = userUtils.getUserStats(self.userID, self.gameMode)
        stats_relax = userUtils.getUserStatsRx(self.userID, self.gameMode)
        stats_relax2 = userUtils.getUserStatsRx2(self.userID, self.gameMode)
        log.debug(str(stats))

        if self.userID == 1001:
            self.irc = False
            self.country = 111
            self.actionID = actions.WATCHING
            self.actionText = "the chat"
        if stats is None:
            log.warning("Stats query returned None")
            return
        if self.relaxing:
            self.gameRank = stats_relax["gameRank"]
            self.pp = stats_relax["pp"]
            self.rankedScore = stats_relax["rankedScore"]
            self.accuracy = stats_relax["accuracy"] / 100
            self.playcount = stats_relax["playcount"]
            self.totalScore = stats_relax["totalScore"]
        elif self.relaxing2:
            self.gameRank = stats_relax2["gameRank"]
            self.pp = stats_relax2["pp"]
            self.rankedScore = stats_relax2["rankedScore"]
            self.accuracy = stats_relax2["accuracy"] / 100
            self.playcount = stats_relax2["playcount"]
            self.totalScore = stats_relax2["totalScore"]
        else:
            self.gameRank = stats["gameRank"]
            self.pp = stats["pp"]
            self.rankedScore = stats["rankedScore"]
            self.accuracy = stats["accuracy"] / 100
            self.playcount = stats["playcount"]
            self.totalScore = stats["totalScore"]