Beispiel #1
0
 def DeleteRoulete(id):
     for i in range(0, db.llen('Rouletes')):
         tempJSON = db.lindex('Rouletes', i)
         loadroulet = json.loads(tempJSON)
         if loadroulet['id'] == id:
             db.lrem('Rouletes', 0, tempJSON)
             break
Beispiel #2
0
    def RouleteCommit(newRouleta):
        for i in range(0, db.llen('Rouletes')):
            tempJSON = db.lindex('Rouletes', i)
            loadroulet = json.loads(tempJSON)
            if loadroulet['id'] == newRouleta.id:
                newrouleteJson = json.dumps(newRouleta.__dict__)
                db.lset('Rouletes', i, newrouleteJson)

        return newRouleta
Beispiel #3
0
    def RouletefindById(FindId):
        newRouleta = None
        for i in range(0, db.llen('Rouletes')):
            tempJSON = db.lindex('Rouletes', i)
            loadroulet = json.loads(tempJSON)
            if loadroulet['id'] == FindId:
                newRouleta = roulete.Roulete(loadroulet['id'])
                newRouleta.state = loadroulet['state']

        return newRouleta
Beispiel #4
0
    def FindIdxFree():
        newindex = db.llen('Rouletes')
        for j in range(0, db.llen('Rouletes')):
            conuntEqual = 0
            for i in range(0, db.llen('Rouletes')):
                tempJSON = db.lindex('Rouletes', i)
                loadroulet = json.loads(tempJSON)
                if loadroulet['id'] == j:
                    conuntEqual = conuntEqual + 1
                    break
            if conuntEqual == 0 and not newindex == j:
                newindex = j
                break

        return newindex
Beispiel #5
0
    def AllRouletes():
        Rouletes = []
        for i in range(0, db.llen('Rouletes')):
            tempJSON = db.lindex('Rouletes', i)
            loadroulet = json.loads(tempJSON)
            newroulute = roulete.Roulete(loadroulet['id'])
            newroulute.BetsTable = loadroulet['BetsTable']
            newroulute.state = loadroulet['state']
            newroulute.ListAllBets()
            RouleteData = {
                'id': loadroulet['id'],
                'roulete': newroulute,
                'message': newroulute.StateToString()
            }
            Rouletes.append(RouleteData)

        return Rouletes