def get(self):
        if not onTeam(): return self.redirect('/')

        user = users.get_current_user()
        if not user:
          self.redirect(users.create_login_url(self.request.uri))
          return

        def formatter(person):
            JSON = {}
            key = getattr(person, 'key')
            JSON['id'] = key.urlsafe()
            JSON['kind'] = key.kind()
            JSON.update(person.asDict(['email', 'name', 'checked_in']))
            return JSON

        from models import Volunteer, Rep

        source = map(formatter, Hacker.query(Hacker.checked_in == False).fetch())
        source += map(formatter, Rep.query(Rep.checked_in == False).fetch())
        source += map(formatter, Volunteer.query(Volunteer.checked_in == False).fetch())

        total_checked_in = getTotal()

        session = models.CheckInSession()
        session.user = user.email()

        session.put()
        token = channel.create_channel(session.key.urlsafe())

        self.response.write(template("checkin.html", {"source" : json.dumps(source), 'total_checked_in' : total_checked_in, 'token' : token}))
    def get(self):
        if not onTeam(): return self.redirect('/')

        user = users.get_current_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        def formatter(person):
            JSON = {}
            key = getattr(person, 'key')
            JSON['id'] = key.urlsafe()
            JSON['kind'] = key.kind()
            JSON.update(person.asDict(['email', 'name', 'checked_in']))
            return JSON

        from models import Volunteer, Rep

        source = map(formatter,
                     Hacker.query(Hacker.checked_in == False).fetch())
        source += map(formatter, Rep.query(Rep.checked_in == False).fetch())
        source += map(formatter,
                      Volunteer.query(Volunteer.checked_in == False).fetch())

        total_checked_in = getTotal()

        session = models.CheckInSession()
        session.user = user.email()

        session.put()
        token = channel.create_channel(session.key.urlsafe())

        self.response.write(
            template(
                "checkin.html", {
                    "source": json.dumps(source),
                    'total_checked_in': total_checked_in,
                    'token': token
                }))
def getTotalFromDB():
    from models import Volunteer, Rep
    total_checked_in = Hacker.query(Hacker.checked_in == True).count()
    total_checked_in += Rep.query(Rep.checked_in == True).count()
    total_checked_in += Volunteer.query(Volunteer.checked_in == True).count()
    return total_checked_in
def getTotalFromDB():
    from models import Volunteer, Rep
    total_checked_in = Hacker.query(Hacker.checked_in == True).count()
    total_checked_in += Rep.query(Rep.checked_in == True).count()
    total_checked_in += Volunteer.query(Volunteer.checked_in == True).count()
    return total_checked_in
Esempio n. 5
0
 def getConfirmedVolunteers(self, query):
     """Returns a list of confirmed volunteers."""
     query = Volunteer.query(Volunteer.confirmed == True)
     return query
Esempio n. 6
0
 def getUnconfirmedVolunteers(self, query):
     """Returns a list of unconfirmed volunteers."""
     query = Volunteer.query(Volunteer.confirmed == False)
     return query