Пример #1
0
    def getContestProblem(self, cid):

        whereclause = ' cid = {} '.format(cid)
        sql = getQuerySQL('cproblem', whereclause, ' cpid ')
        rs = FetchAll(sql)

        return rs
Пример #2
0
    def getProblemList(self, cid, uid):
        wherecluse = ' cid = {} '.format(cid)
        ordclause = ' cpid '

        sql = getQuerySQL(' cproblem ', wherecluse, ordclause)

        print(sql)
        rs = FetchAll(sql)

        ac = [0 for i in range(len(rs))]
        tr = [0 for i in range(len(rs))]

        for i in range(len(rs)):
            if uid is not None:
                ac[i] = CheckContestIfAccept(uid, rs[i][2], cid)[0]
                if ac[i] == 1: tr[i] = 1
                else: tr[i] = CheckContestIfTry(uid, rs[i][2], cid)[0]

        totalsubmit = CountContestSubmitNum(cid)
        acsubmit = CountContestACNum(cid)

        td = dict()
        ad = dict()
        for x in totalsubmit:
            td[x[0]] = x[1]
        for x in acsubmit:
            ad[x[0]] = x[1]
        '''
        print(rs)
        print(ac)
        print(td)
        print(ad)
        '''

        return rs, ac, td, ad, tr
Пример #3
0
    def getContestDetail(self, cid):

        whereclause = ' cid = {} '.format(cid)
        sql = getQuerySQL('contest', whereclause, ' cid ')
        rs = FetchOne(sql)

        return rs
Пример #4
0
    def getProblemList(self, cid,uid):
        wherecluse = ' cid = {} '.format(cid)
        ordclause = ' cpid '

        sql = getQuerySQL(' cproblem ', wherecluse, ordclause)

        print(sql)
        rs = FetchAll(sql)

        ac = [ 0 for i in range(len(rs)) ]
        tr = [ 0 for i in range(len(rs)) ]

        for i in range(len(rs)) :
            if uid is not None :
                ac[i] = CheckContestIfAccept(uid,rs[i][2],cid)[0]
                if ac[i]==1: tr[i]=1
                else : tr[i] = CheckContestIfTry(uid,rs[i][2],cid)[0]


        totalsubmit = CountContestSubmitNum(cid)
        acsubmit = CountContestACNum(cid)

        td = dict()
        ad = dict()
        for x in totalsubmit: td[x[0]] = x[1]
        for x in acsubmit : ad[x[0]] = x[1]

        '''
        print(rs)
        print(ac)
        print(td)
        print(ad)
        '''

        return rs,ac,td,ad,tr
Пример #5
0
    def getContestStatus(self, cid):

        sql = getQuerySQL('contest', ' cid = {} '.format(cid), ' cid ')

        # print(sql)
        rs = FetchOne(sql)

        return rs[10]
Пример #6
0
    def getContestStatus(self, cid):

        sql = getQuerySQL('contest', ' cid = {} '.format(cid), ' cid ')

        # print(sql)
        rs = FetchOne(sql)

        return rs[10]
Пример #7
0
    def getStatusInfo(self, cid):

        whereclause = ' cid = {} '.format(cid)
        ordclause = ' sid '

        sql = getQuerySQL('status', whereclause=whereclause, ordclause=ordclause)
        rs = FetchAll(sql)

        return rs
Пример #8
0
    def getStatusInfo(self, cid):

        whereclause = ' cid = {} '.format(cid)
        ordclause = ' sid '

        sql = getQuerySQL('status',
                          whereclause=whereclause,
                          ordclause=ordclause)
        rs = FetchAll(sql)

        return rs
Пример #9
0
def UpdateProblemDetail(problem, pid):
    pretreat_ProblemDetail(problem)

    sql = getQuerySQL('problemdetail',' pid={} '.format(pid),' did ')
    rs = FetchOne(sql)

    if rs is None :
        InsertProblemDetail(problem)
    else :
        clause = 'problemdetail.pid = %d' % pid
        sql = getUpdateSQL('problemdetail', data=problem, clause=clause)
        ExeSQL(sql)
Пример #10
0
def UpdateProblemDetail(problem, pid):
    pretreat_ProblemDetail(problem)

    sql = getQuerySQL('problemdetail', ' pid={} '.format(pid), ' did ')
    rs = FetchOne(sql)

    if rs is None:
        InsertProblemDetail(problem)
    else:
        clause = 'problemdetail.pid = %d' % pid
        sql = getUpdateSQL('problemdetail', data=problem, clause=clause)
        ExeSQL(sql)
Пример #11
0
    def getUserInfo(self, username):

        if len(username) == 0:
            return None

        where = ' username = "******" '.format(username)
        sql = getQuerySQL('user', whereclause=where, ordclause=' uid ')
        rs = FetchOne(sql)

        print(rs)

        return rs
Пример #12
0
    def getUserInfo(self, username):

        if len(username) == 0:
            return None

        where = ' username = "******" '.format(username)
        sql = getQuerySQL('user', whereclause=where, ordclause=' uid ')
        rs = FetchOne(sql)

        print(rs)

        return rs
Пример #13
0
    def getSubmitData(self, sid):

        sql = getQuerySQL('status', ' sid = {} '.format(sid), ' sid ')
        rs = FetchOne(sql)

        return rs
Пример #14
0
    def getSubmitData(self, sid):

        sql = getQuerySQL('status', ' sid = {} '.format(sid), ' sid ')
        rs = FetchOne(sql)

        return rs