コード例 #1
0
ファイル: breakdown.py プロジェクト: jinzhuw/football
 def post(self, week):
     week = int(week)
     if week + 1 < weeks.current() or not weeks.check_deadline(week + 1):
         self.abort(403)
     text = self.request.POST.get('text')
     count = int(self.request.get('count'))
     created_after = self.request.get('created-after')
     breakdown.save_comment(week, self.user, text)
     self.return_comments(week, count, after=created_after)
コード例 #2
0
ファイル: main.py プロジェクト: jinzhuw/football
 def _login(self, user, real_redirect):
     if not user:
         self.abort(403)
     self.login(user)
     if not self.user.name:
         self._redirect('/setup/activation', real_redirect)
     elif entries.unnamed_entries(self.user.key().id()) > 0:
         self._redirect('/setup/entries', real_redirect)
     elif not weeks.check_deadline(weeks.current()):
         self._redirect('/breakdown', real_redirect)
     else:
         self._redirect('/picks', real_redirect)
コード例 #3
0
ファイル: entries.py プロジェクト: jinzhuw/football
def buyback_entry(entry_id):
    week = weeks.current()
    entry = Entry.get_by_id(entry_id)
    entry.alive = True
    entry.put()
    send_email_user_id = None
    if not weeks.check_deadline(week):
        # buying back before the new week has started
        buyback_pick = Pick.get_by_key_name(_pick_key(week, entry_id))
    else:
        # attempting to buyback after the week has ended
        buyback_pick = Pick.get_by_key_name(_pick_key(week - 1, entry_id))
        _create_pick(entry, week)
        send_email_user_id = entry.user_id
    if buyback_pick:
        buyback_pick.buyback = True
        buyback_pick.put()
    return send_email_user_id
コード例 #4
0
ファイル: picks.py プロジェクト: jinzhuw/football
 def get(self):
     week = weeks.current()
     user_entries = entries.entries_for_user(self.user)
     user_picks = entries.picks_for_user(self.user, week)
     picks = []
     for pick in user_picks.itervalues():
         entry = user_entries[pick.entry_id]
         if entry.activated:
             picks.append((entry.name, entry.key().id(), pick))
          
     args = {
         'week': week,
         'picks': sorted(picks),
         'current_time': time.mktime(weeks.current_time().timetuple()),
         'deadline': weeks.deadline(week),
         'deadline_passed': not weeks.check_deadline(week),
     }
     logging.debug(args)
     
     view.render(self, 'picks', args, css=True, js=True)
コード例 #5
0
ファイル: breakdown.py プロジェクト: jinzhuw/football
 def get(self):
     week = weeks.current() - 1
     if not weeks.check_deadline(weeks.current()):
         # after the deadline users can see the stats breakdown
         week += 1
     view.render(self, 'breakdown', {'week': week}, js=True, css=True)