Example #1
0
    def get(self):

        # Create and insert a record
        # for this registration.
        record = Team(user=self.auth.get_user_by_session()['user_id'],
                      paid=False,
                      year=YEAR)
        record.put()

        # Inform the client of success.
        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({'id': record.key.id()}))
Example #2
0
    def get(self):
        ids = json.loads(self.request.get('ids'))
        record = Team(user=-1,
                      paid=False,
                      name="Individual Team",
                      year=get_year())
        record.put()
        for i in ids:
            indiv = Individual.get_by_id(i)
            indiv.team = record.key.id()
            indiv.put()

        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({"success": True}))
Example #3
0
    def post(self):
        user_email = self.request.get('user_email')

        user_query = LegacyUser.query(LegacyUser.email == user_email)
        user = user_query.get()
        user_id = None

        if user is None:
            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(json.dumps({
                'success': False
            }))
            return
        else:
            user_id = user.key.id()

        team_name = self.request.get('team_name')
        members = json.loads(self.request.get('members'))

        team = Team(
            name = team_name,
            user = user_id,
            guts_scores = self.request.get('guts_scores'),
            team_scores = self.request.get('team_scores'),
            paid = False,
            year = 2013
        )
        team.put()

        team_id = team.key.id()

        for member in members:
            individual = Individual(
                name = member['name'],
                team = team_id,
                user = user_id,
                paid = True,
                year = 2013,

                speed_scores = member['speed_scores'],
                accuracy_scores = member['accuracy_scores']
            )

            individual.put()

        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({
            'success': True
        }))
Example #4
0
    def get(self):
        ids = json.loads(self.request.get('ids'))
        record = Team(
            user = -1,
            paid = False,
            name = "Individual Team",
            year = get_year()
        )
        record.put()
        for i in ids:
            indiv = Individual.get_by_id(i)
            indiv.team = record.key.id()
            indiv.put()

        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({"success": True}))
Example #5
0
    def get(self):

        # Create and insert a record
        # for this registration.
        record = Team(
            user = self.auth.get_user_by_session()['user_id'],
            paid = False,
            year = YEAR
        )
        record.put()

        # Inform the client of success.
        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({
            'id': record.key.id()
        }))
Example #6
0
    def post(self):
        user_email = self.request.get('user_email')

        user_query = LegacyUser.query(LegacyUser.email == user_email)
        user = user_query.get()
        user_id = None

        if user is None:
            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(json.dumps({'success': False}))
            return
        else:
            user_id = user.key.id()

        team_name = self.request.get('team_name')
        members = json.loads(self.request.get('members'))

        team = Team(name=team_name,
                    user=user_id,
                    guts_scores=self.request.get('guts_scores'),
                    team_scores=self.request.get('team_scores'),
                    paid=False,
                    year=2013)
        team.put()

        team_id = team.key.id()

        for member in members:
            individual = Individual(name=member['name'],
                                    team=team_id,
                                    user=user_id,
                                    paid=True,
                                    year=2013,
                                    speed_scores=member['speed_scores'],
                                    accuracy_scores=member['accuracy_scores'])

            individual.put()

        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(json.dumps({'success': True}))