def getContestProblem(self, cid):

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

        return rs
Example #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
    def getContestDetail(self, cid):

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

        return rs
    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
Example #5
0
    def getContestStatus(self, cid):

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

        # print(sql)
        rs = FetchOne(sql)

        return rs[10]
Example #6
0
    def getContestStatus(self, cid):

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

        # print(sql)
        rs = FetchOne(sql)

        return rs[10]
    def getStatusInfo(self, cid):

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

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

        return rs
Example #8
0
    def getStatusInfo(self, cid):

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

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

        return rs
Example #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)
Example #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)
Example #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
    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
    def getSubmitData(self, sid):

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

        return rs
Example #14
0
    def getSubmitData(self, sid):

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

        return rs