示例#1
0
 def post( self ):
     """ Let's a User assign a [1, 10] value for the current Meal. """
     user = self.get_user()
     meal = Meal.get_current()
     
     # Create the Vote.
     vote = Vote.create( meal, user, int(self.request.get('value') ) )
示例#2
0
    def get( self ):
        meal     = Meal.get_current()
        stats    = Stats.all().get()
        checkins = Checkin.get_by_meal( meal )
        
        stats.lunch_checkin_count += checkins.count()
        stats.lunch_checkin_days  += 1

        stats.put()
示例#3
0
    def post( self ):
        first_name = self.request.get( 'first_name' )
        email      = self.request.get( 'email' )
        meal       = Meal.get_current()

        # Hack ... TODO: fix this eventually.
        random.seed( email )
        time.sleep( random.randint(0, 29) )

        # Send out that email! 
        Email.meal_notification( email, first_name, meal.menu )
示例#4
0
    def post( self ):
        menu   = self.request.get('menu').strip()
        type   = self.request.get('type').upper()
        rating = self.request.get('rating')

        if menu is not "":
            # Update the current meal to become an old meal
            current_meal = Meal.get_current()
            if current_meal:
                current_meal.status = 'past_meal'
                current_meal.rating = int( rating )
                current_meal.put()

            # Create the new meal
            new_meal = Meal.create( type, menu )

            # Tell people the meal is here!!!
            users = User.all().filter( 'notification =', True ).filter( 'email !=', '' )
            for u in users:
                taskqueue.add( queue_name = 'notificationEmail', 
                               url        = url( 'NotifyUsers' ),
                               params     = {'first_name' : u.first_name,
                                             'email'      : u.email,
                                             'menu'       : menu } )
示例#5
0
    def post( self ):
        # Given a User uuid, create a Checkin obj. 
        user = User.get( self.request.get('user_uuid') )
        meal = Meal.get_current()

        Checkin.create( meal, user )
示例#6
0
 def get(self, page):
     template_values = { 'meal' : Meal.get_current() }
     
     self.response.out.write(self.render_page('index.html', template_values))