Beispiel #1
0
    def dropMap(cls, beatmap: int) -> None:
        if cls.exist(beatmap):
            cls.execute(
                Executor.update('user', 'rating=rating-1',
                                f"beatmap='{beatmap}'"))
            return

        cls.addMap(beatmap)
        cls.dropMap(beatmap)
Beispiel #2
0
    def addMapToPushed(cls, user: str, beatmap: int) -> None:
        if cls.exists(user):
            pushed = cls.getPushedMaps(user)
            pushed.append(beatmap)

            cls.execute(Executor.update("user", f"pushed='{pushed}'"))
        else:
            cls.addStat(user)
            cls.addMapToPushed(user, beatmap)
Beispiel #3
0
    def dailyUpdate(cls, user: str, debug: bool = False) -> None:
        now = round(time())

        if debug:
            now = 999999999999999

        if round((now - cls.getLastUpdate(user)) / 60 / 60) > 24:
            user_data = us.User()
            user_data.setUser(user)

            acc = user_data.acc
            pp = user_data.pp

            star_avg = user_data.calcAvgStar()

            now = round(time())

            cls.execute(
                Executor.update(
                    "user",
                    f"acc={acc}, pp={pp}, star_avg={star_avg}, last_use={now}",
                    f"name='{user}'"))
Beispiel #4
0
 def set_language(self, language: str) -> None:
     self.execute(
         Executor.update("lang", f"lang='{language}'",
                         f"name='{self.name}'"))
Beispiel #5
0
 def pushMap(cls, beatmap: int) -> None:
     cls.execute(
         Executor.update('user', 'rating=rating+1', f"beatmap='{beatmap}'"))