Exemple #1
0
 async def get(self, *, rule: int = 0, page: int = 1):
     if not rule:
         tdocs = contest.get_multi(self.domain_id, document.TYPE_CONTEST)
         qs = ''
     else:
         if rule not in constant.contest.CONTEST_RULES:
             raise error.ValidationError('rule')
         tdocs = contest.get_multi(self.domain_id,
                                   document.TYPE_CONTEST,
                                   rule=rule)
         qs = 'rule={0}'.format(rule)
     tdocs, tpcount, _ = await pagination.paginate(tdocs, page,
                                                   self.CONTESTS_PER_PAGE)
     tsdict = await contest.get_dict_status(self.domain_id,
                                            self.user['_id'],
                                            document.TYPE_CONTEST,
                                            (tdoc['doc_id']
                                             for tdoc in tdocs))
     self.render('contest_main.html',
                 page=page,
                 tpcount=tpcount,
                 qs=qs,
                 rule=rule,
                 tdocs=tdocs,
                 tsdict=tsdict)
Exemple #2
0
 async def get(self, *, rule: int=0, page: int=1):
   if not rule:
     tdocs = contest.get_multi(self.domain_id)
     qs = ''
   else:
     tdocs = contest.get_multi(self.domain_id, rule=rule)
     qs = 'rule={0}'.format(rule)
   tdocs, tpcount, _ = await pagination.paginate(tdocs, page, self.CONTESTS_PER_PAGE)
   tsdict = await contest.get_dict_status(self.domain_id, self.user['_id'],
                                          (tdoc['doc_id'] for tdoc in tdocs))
   self.render('contest_main.html', page=page, tpcount=tpcount, qs=qs, rule=rule,
               tdocs=tdocs, tsdict=tsdict)
Exemple #3
0
 async def get(self, *, rule: int=0, page: int=1):
   if not rule:
     tdocs = contest.get_multi(self.domain_id, document.TYPE_CONTEST)
     qs = ''
   else:
     if rule not in constant.contest.CONTEST_RULES:
       raise error.ValidationError('rule')
     tdocs = contest.get_multi(self.domain_id, document.TYPE_CONTEST, rule=rule)
     qs = 'rule={0}'.format(rule)
   tdocs, tpcount, _ = await pagination.paginate(tdocs, page, self.CONTESTS_PER_PAGE)
   tsdict = await contest.get_dict_status(self.domain_id, self.user['_id'], document.TYPE_CONTEST,
                                         (tdoc['doc_id'] for tdoc in tdocs))
   self.render('contest_main.html', page=page, tpcount=tpcount, qs=qs, rule=rule,
               tdocs=tdocs, tsdict=tsdict)