Exemplo n.º 1
0
    def get(self):
        active_tas = dict()
        for line in open('tas.dat', 'r'):
            tmp = line.split(',')
            ta = LabTA(parent=labta_key())
            logging.info(line)
            ta.first_name = tmp[0]
            ta.last_name = tmp[1]
            ta.class_year = tmp[2]
            ta.email = tmp[3].strip()
            ta.is_active = True
            active_tas[ta.email] = ta

        # Ones already in the DB
        for t in LabTA.query().fetch():
            if t.email in active_tas:
                tmp = active_tas[t.email]
                t.first_name = tmp.first_name
                t.last_name = tmp.last_name
                t.class_year = tmp.class_year
                t.is_active = True
                del active_tas[t.email]
            else:
                t.is_active = False
            t.put()
        # Add the new TAs
        for t in active_tas.itervalues():
            t.put()
        self.response.write("Update Complete.")
Exemplo n.º 2
0
    def get(self):
        active_tas = dict()
        for line in open('tas.dat', 'r'):
            tmp = line.split(',')
            ta = LabTA(parent=labta_key())
            logging.info(line)
            ta.first_name = tmp[0]
            ta.last_name = tmp[1]
            ta.class_year = tmp[2]
            ta.email = tmp[3].strip()
            ta.is_active = True
            active_tas[ta.email] = ta

        # Ones already in the DB
        for t in LabTA.query().fetch():
            if t.email in active_tas:
                tmp = active_tas[t.email]
                t.first_name = tmp.first_name
                t.last_name = tmp.last_name
                t.class_year = tmp.class_year
                t.is_active = True
                del active_tas[t.email]
            else:
                t.is_active = False
            t.put()
        # Add the new TAs
        for t in active_tas.itervalues():
            t.put()
        self.response.write("Update Complete.")
Exemplo n.º 3
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:
         update_active_tas(user.email())
         hr.been_helped = True
         hr.helped_datetime = datetime.utcnow()
         hr.attending_ta = user.email()
         hr.put()
         ChannelManager.queue_update()
         ta = LabTA.query(LabTA.email == hr.attending_ta,
                          ancestor=labta_key()).fetch()[0]
         ChannelManager.notify_request_accepted(hr.netid,
                                                ta.first_name,
                                                ta.img_path)
Exemplo n.º 4
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
     update_active_tas(user.email())
     hr = q.get()
     hr.been_helped = True
     hr.helped_datetime = datetime.utcnow()
     hr.attending_ta = user.email()
     hr.put()
     ChannelManager.queue_update()
     ta = LabTA.query(LabTA.email == hr.attending_ta,
                      ancestor=labta_key()).fetch()[0]
     ChannelManager.notify_request_accepted(hr.netid, ta.first_name,
                                            ta.img_path)