Esempio n. 1
0
    def getTop(cls, by: str = 'user', limit: int = 10) -> list:
        if limit == 'max':
            top = cls.execute(
                Executor.select("*", f"{by}", order="rating desc"))

            return top

        top = cls.execute(
            Executor.select("*", f"{by}", order="rating desc", limit=limit))

        return top
Esempio n. 2
0
    def exists(cls, user: str) -> bool:
        try:
            if cls.execute(Executor.select("*", "user", f"name='{user}'")):
                return True
        except:
            return False

        return False
Esempio n. 3
0
    def exists(self) -> None:
        try:
            if self.execute(
                    Executor.select("name", "lang", f"name='{self.name}'")):
                return True
        except:
            return False

        return False
Esempio n. 4
0
    def getStat(cls, user: str) -> list:
        if not (cls.exists(user)):
            cls.addStat(user)

        stat = cls.execute(Executor.select("*", "user", f"name='{user}'"))

        stat = stat[0]

        return stat
Esempio n. 5
0
    def exist(cls, beatmap: int) -> bool:
        try:
            if cls.execute(
                    Executor.select("beatmap", "user", f"beatmap={beatmap}")):
                return True
        except:
            return False

        return False
Esempio n. 6
0
    def getPushedMaps(cls, user: str) -> list:
        pushed = cls.execute(
            Executor.select("pushed", "user", f"name='{user}'"))[0][0]

        if pushed:
            pushed = eval(pushed)
        else:
            pushed = list()

        return pushed
Esempio n. 7
0
 def get_language(self) -> str:
     lang = self.execute(
         Executor.select("lang", "lang", f"name='{self.name}'"))[0]
     return lang[0]
Esempio n. 8
0
    def getLastNP(cls) -> list:
        last = cls.execute(Executor.select('*', 'np'))[0]

        return last