Beispiel #1
0
 def get(self):
     user = users.get_current_user()
     json_queue = QueueManager.get_json_queue()
     token = channel.create_channel(user.email())
     if is_ta(user.email()):
         logging.info("{} is a TA".format(user.email()))
     template_values = {'logout_url': users.create_logout_url('/'),
                        'schedule_url': "http://labta.cs.princeton.edu", 
                        'is_ta': is_ta(user.email()),
                        'curr_user': user.email(),
                        'token': token,
                        'queue': base64.b64encode(json_queue),
                        'active_tas': LabTA.update_active_tas()}
     template = JINJA_ENVIRONMENT.get_template('templates/HelpQueue.html')
     self.response.write(template.render(template_values))
Beispiel #2
0
 def get(self):
     user = users.get_current_user()
     json_queue = QueueManager.get_json_queue()
     token = channel.create_channel(user.email())
     if is_ta(user.email()):
         logging.info("{} is a TA".format(user.email()))
     template_values = {
         'logout_url': users.create_logout_url('/'),
         'schedule_url': "http://labta.cs.princeton.edu/schedule.html",
         'is_ta': is_ta(user.email()),
         'curr_user': user.email(),
         'token': token,
         'queue': base64.b64encode(json_queue),
         'active_tas': LabTA.update_active_tas()
     }
     template = JINJA_ENVIRONMENT.get_template('templates/HelpQueue.html')
     self.response.write(template.render(template_values))
Beispiel #3
0
 def post(self):
     user = users.get_current_user()
     q = HelpRequest.query(HelpRequest.in_queue == True,
                           HelpRequest.netid == self.request.get('email'),
                           ancestor=help_queue_key())
     if q.count() != 1:
         logging.error("Database corrupted for user {}".format(
             user.email()))
         return
     if is_ta(user.email()):
         update_active_tas(user.email())
     hr = q.get()
     hr.canceled = True
     hr.put()
     ChannelManager.queue_update()
Beispiel #4
0
    def post(self):
        user = users.get_current_user()

        # NOTE: previously this command could be run by anybody; now it
        # is restricted to TAs; consider restricting this further.
        
        if is_ta(user.email()):
          logging.info("User {} cleared the queue".format(user.email()))
          q = HelpRequest.query(HelpRequest.in_queue == True,
                                ancestor=help_queue_key()).fetch()
          for hr in q:
              hr.canceled = True

              # NOTE: same as above, if cancelled by TA, mark it.
              if hr.netid != user.email():
                   hr.attending_ta = user.email()
              
              hr.put()
          ChannelManager.queue_update()
Beispiel #5
0
 def post(self):
     user = users.get_current_user()
     hr = fetch_help_request(requester = self.request.get('email'),
                             full_id   = self.request.get('full_id'))
     if hr:
        hr.canceled = True
        
        if is_ta(user.email()):
            update_active_tas(user.email())
            
            # Update this field if the cancellation comes from the TA
            # and the TA isn't the originator of the request
            #
            # FIXME: there should be a field dedicated to the canceller.
            
            if hr.netid != user.email():
                hr.attending_ta = user.email()
              
        hr.put()
        ChannelManager.queue_update()