Пример #1
0
	def get(self):
		w = self.response.out
		team_a = self.request.get('team_a')
		team_b = self.request.get('team_b')
		if team_a == "":
			w.write('illegal request, need name for team a')
			return
		if team_b == "":
			w.write('illegal request, need name for team b')
			return
			
		matches = Matchup.all().filter('team_a_name = ', team_a).filter('team_b_name = ', team_b).fetch(1)
		if len(matches) == 0:
			w.write('no matches found')
			return
		
		match = matches[0]
		w.write("<h1>%s vs %s</h1>" % (match.team_a_name, match.team_b_name))
		w.write("<div>Match date: %s </div>" % match.date_match_formatted)
		bets = Bet.all().filter('match = ', match).fetch(1000)
		w.write("<table>")
		w.write("<tr><td>%s</td><td>Draw</td><td>%s</td><td>Recorded on</td><td>Current score</td></tr>" % (match.team_a_name, match.team_b_name))
		for b in bets:
			w.write("<tr>")
			w.write("<td>%s</td>" % b.team_a_odds)
			w.write("<td>%s</td>" % b.draw_odds)
			w.write("<td>%s</td>" % b.team_b_odds)
			w.write("<td>%s</td>" % b.date_recorded)
			w.write("<td>%s</td>" % b.current_score)
			w.write("</tr>")
		w.write("</table>")
		w.write('found %s bets' % len(bets))
Пример #2
0
 def get(self):
   betalinger = []
   status = False
   qry = Bet.all().filter('Summabogfort !=', True)
   for bet in qry:
     for betlin in bet.listBetlin:
       if betlin.Fakref:
         if betlin.Fakref.SFaknr > 0:
           betalinger.append(betlin)
           status = True
   template_values = {
     'status': status,
     'betalinger': betalinger,
   }
   path = os.path.join(os.path.dirname(__file__), 'templates/bogforindbetalinger.xml')
   self.response.out.write(template.render(path, template_values)) 
Пример #3
0
	def get(self):
			w = self.response.out
			offset = self.request.get('offset')
			limit = self.request.get('limit')
			
			if limit is "":
			    limit = 100
			if offset is "":
			    offset = 0
			
			limit = int(limit)
			offset = int(offset)
			matches = Matchup.all()[offset:limit+offset]
			for m in matches:
				bets = Bet.all().filter("match = ", m)
				for b in bets:
					template = "%s;%s;%s;%s;%s;%s;%s" % (m.team_a_name, m.team_b_name, b.team_a_odds, b.team_b_odds,b.draw_odds,m.date_match_formatted, b.date_recorded)
					w.write(template)
					w.write("<br/>")
Пример #4
0
def main():
    bets = Bet.all().order('-ctime').fetch(1000)
    #days = Day.all().filter('year =', 2011).filter('month =', 6).order('day').fetch(100)
    days = Day.all().fetch(100)
    return render_template("main.html", bets=bets, days=days)
Пример #5
0
    def calc_fluctuation(self, m):
        bets = Bet.all().filter("match = ", m)
        s = set()

        map(s.add, [(b.team_a_odds, b.team_b_odds, b.draw_odds) for b in bets])
        return len(s)