Browse Source

.SCORES. Cythonized some files

tags/v1.12.0
Giuseppe Guerra 3 years ago
parent
commit
7726a018aa
9 changed files with 26 additions and 24 deletions
  1. +1
    -1
      handlers/apiCacheBeatmapHandler.py
  2. +1
    -1
      handlers/apiPPHandler.py
  3. +3
    -2
      handlers/getScoresHandler.pyx
  4. +3
    -3
      handlers/submitModularHandler.pyx
  5. +0
    -0
      objects/beatmap.pyx
  6. +1
    -1
      objects/score.pyx
  7. +14
    -13
      objects/scoreboard.pyx
  8. +1
    -1
      pubSubHandlers/beatmapUpdateHandler.py
  9. +2
    -2
      tomejerry.py

+ 1
- 1
handlers/apiCacheBeatmapHandler.py View File

@@ -6,7 +6,7 @@ import tornado.gen
import tornado.web
from raven.contrib.tornado import SentryMixin

import beatmap
from objects import beatmap
from common.log import logUtils as log
from common.web import requestsManager
from constants import exceptions


+ 1
- 1
handlers/apiPPHandler.py View File

@@ -6,7 +6,7 @@ import tornado.gen
import tornado.web
from raven.contrib.tornado import SentryMixin

import beatmap
from objects import beatmap
from common.constants import gameModes
from common.log import logUtils as log
from common.web import requestsManager


handlers/getScoresHandler.py → handlers/getScoresHandler.pyx View File

@@ -5,14 +5,15 @@ import tornado.gen
import tornado.web
from raven.contrib.tornado import SentryMixin

import beatmap
import scoreboard
from objects import beatmap
from objects import scoreboard
from common.constants import privileges
from common.log import logUtils as log
from common.ripple import userUtils
from common.web import requestsManager
from constants import exceptions
from objects import glob
import time

MODULE_NAME = "get_scores"
class handler(SentryMixin, requestsManager.asyncRequestHandler):

handlers/submitModularHandler.py → handlers/submitModularHandler.pyx View File

@@ -10,9 +10,9 @@ import tornado.gen
import tornado.web
from raven.contrib.tornado import SentryMixin

import beatmap
import score
import scoreboard
from objects import beatmap
from objects import score
from objects import scoreboard
from common.constants import gameModes
from common.log import logUtils as log
from common.ripple import userUtils

beatmap.py → objects/beatmap.pyx View File


score.py → objects/score.pyx View File

@@ -1,6 +1,6 @@
import time

import beatmap
from objects import beatmap
from common.constants import gameModes
from common.log import logUtils as log
from common.ripple import userUtils

scoreboard.py → objects/scoreboard.pyx View File

@@ -1,4 +1,4 @@
import score
from objects import score
from common.ripple import userUtils
from constants import rankedStatuses
from objects import glob
@@ -44,13 +44,13 @@ class scoreboard:
return

# Query parts
select = ""
joins = ""
country = ""
mods = ""
friends = ""
order = ""
limit = ""
cdef str select = ""
cdef str joins = ""
cdef str country = ""
cdef str mods = ""
cdef str friends = ""
cdef str order = ""
cdef str limit = ""

# Find personal best score
if self.userID != 0:
@@ -116,14 +116,15 @@ class scoreboard:
topScores = glob.db.fetchAll(query, params)

# Set data for all scores
c = 1
cdef int c = 1
cdef dict topScore
if topScores is not None:
for i in topScores:
for topScore in topScores:
# Create score object
s = score.score(i["id"], setData=False)
s = score.score(topScore["id"], setData=False)

# Set data and rank from topScores's row
s.setDataFromDict(i)
s.setDataFromDict(topScore)
s.setRank(c)

# Check if this top 50 score is our personal best
@@ -169,7 +170,7 @@ class scoreboard:
Ikr, that query is HUGE but xd
"""
# Before running the HUGE query, make sure we have a score on that map
query = "SELECT id FROM scores WHERE beatmap_md5 = %(md5)s AND userid = %(userid)s AND play_mode = %(mode)s AND completed = 3"
cdef str query = "SELECT id FROM scores WHERE beatmap_md5 = %(md5)s AND userid = %(userid)s AND play_mode = %(mode)s AND completed = 3"
# Mods
if self.mods > -1:
query += " AND scores.mods = %(mods)s"

+ 1
- 1
pubSubHandlers/beatmapUpdateHandler.py View File

@@ -1,6 +1,6 @@
from common.redis import generalPubSubHandler
from helpers import osuapiHelper
import beatmap
from objects import beatmap

def updateSet(beatmapSetID):
apiResponse = osuapiHelper.osuApiRequest("get_beatmaps", "s={}".format(beatmapSetID), False)


+ 2
- 2
tomejerry.py View File

@@ -6,8 +6,8 @@ import time

import progressbar

import beatmap
import score
from objects import beatmap
from objects import score
from common.constants import bcolors
from common.db import dbConnector
from common.ripple import userUtils


Loading…
Cancel
Save