def get(self, raceKey): if not users.get_current_user(): """ If users are not logged in redirect to a login page """ url = users.create_login_url(self.request.uri) self.redirect(url, False) return race = Race.get(raceKey) my_runner = self.raceService.joinRace(users.get_current_user(), race) channel_token = channel.create_channel(str(my_runner.key())) template_values = { 'race_name': race.name, 'race_key': raceKey, 'race_description': race.description, 'race_status': race.status, 'runner_key': str(my_runner.key()), 'runner_ready': "true" if my_runner.ready else "false", 'channel_token': channel_token, 'runners': self.raceService.getRunnersAsModel(race) } logging.error(my_runner.ready) path = os.path.join(os.path.dirname(__file__), '../../templates/show-race.html') self.response.out.write(template.render(path, template_values)) self.raceService.sendUpdateToRunners(my_runner, race)
def get(self, raceKey): if not users.get_current_user(): """ If users are not logged in redirect to a login page """ url = users.create_login_url(self.request.uri) self.redirect(url, False) return; race = Race.get(raceKey) my_runner = self.raceService.joinRace(users.get_current_user(), race) channel_token = channel.create_channel(str(my_runner.key())) template_values = { 'race_name': race.name, 'race_key': raceKey, 'race_description': race.description, 'race_status': race.status, 'runner_key': str(my_runner.key()), 'runner_ready' : "true" if my_runner.ready else "false", 'channel_token': channel_token, 'runners' : self.raceService.getRunnersAsModel(race) } logging.error(my_runner.ready); path = os.path.join(os.path.dirname(__file__), '../../templates/show-race.html') self.response.out.write(template.render(path, template_values)) self.raceService.sendUpdateToRunners(my_runner, race)
def get(self, raceKey): race = Race.get(raceKey) runners = race.runner_set response = {} for runner in runners: email = str(runner.user) response[email] = runner.position self.response.out.write(simplejson.dumps(response))
def get(self, raceKey): """ Render a html portion showing the race podium """ race = Race.get(raceKey) self.raceService.getRunnersAsModel(race) template_values = {'runners': self.raceService.getRunnersAsModel(race)} path = os.path.join(os.path.dirname(__file__), '../../templates/show-race-podium.html') self.response.out.write(template.render(path, template_values))
def get(self, raceKey): """ Render a html portion showing the race podium """ race = Race.get(raceKey) self.raceService.getRunnersAsModel(race) template_values = { 'runners' : self.raceService.getRunnersAsModel(race) } path = os.path.join(os.path.dirname(__file__), '../../templates/show-race-podium.html') self.response.out.write(template.render(path, template_values))