Beispiel #1
0
    def post(self):
        """
        HTTP POST method to create groups.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # So first we need to get at the course and section
        course, section = utils.get_course_and_section_objs(self.request, instructor)
        # Grab the action from the page
        action = self.request.get('action')
        # Check that the action was actually supplied
        if not action:
            # Error if not
            utils.error('Invalid argument: action is null', handler=self)
        else:
            # Switch on the action
            utils.log('action = ' + action)
            if action == 'add':
                # If add, grab the number of groups from the page
                group_count = int(self.request.get('groups'))
                # And modify the database
                self.modify_group_count(section, group_count)
            elif action == 'update':
                # For update, grab the group settings from the page
                groups = json.loads(self.request.get('groups'))
                # And modify the database
                self.update_groups(section, groups)
            else:
                # Send an error if a different action is supplied
                utils.error('Unknown action' + action if action else 'None', handler=self)
Beispiel #2
0
    def get(self):
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Otherwise, create a logout url
        logout_url = users.create_logout_url(self.request.uri)
        # And get the course and section names from the page
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # Grab all the courses and sections for the logged in instructor
        template_values = utils.get_template_all_courses_and_sections(
            instructor, course_name.upper(), selected_section_name.upper())
        logout_url = users.create_logout_url(self.request.uri)
        template_values['logouturl'] = logout_url
        if 'selectedSectionObject' in template_values:
            # If so, grab that section from the template values
            current_section = template_values['selectedSectionObject']
            if current_section.students:
                # template_values['students'] = current_section.students
                template_values['num_std'] = len(current_section.students)
            if current_section.rounds:
                template_values['rounds'] = current_section.rounds
            if current_section.groups:
                template_values['num_group'] = current_section.groups
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        template = utils.jinja_env().get_template(
            'instructor/show_responses.html')
        self.response.write(template.render(template_values))
Beispiel #3
0
    def get(self):
        """
        HTTP GET method to retrieve the list of students from the datastore.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Otherwise, create a logout url
        logout_url = users.create_logout_url(self.request.uri)
        # Get the course and section name from the webpage
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # And start building the template values
        template_values = utils.get_template_all_courses_and_sections(instructor, course_name.upper(),
                                                                      selected_section_name.upper())
        template_values['logouturl'] = logout_url
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        # Set the template and render the page
        template = utils.jinja_env().get_template('instructor/list_students.html')
        self.response.write(template.render(template_values))
Beispiel #4
0
    def get(self):
        # First, check that the logged in user is a student
        student = utils.check_privilege(model.Role.student)
        if not student:
            # Redirect home if not a student
            return self.redirect('/home')
        # end

        # Otherwise, log which student made the get
        utils.log('Student logged in: ' + str(student))
        # And grab the key for the section
        section_key = self.request.get('section')
        # Make sure that it isn't null
        if not section_key:
            # Error if so, and redirect home
            utils.error('Section_key is null')
            self.redirect('/home')
        else:
            # And then grab the section from the key
            section = ndb.Key(urlsafe=section_key).get()
            # Making sure it's not null
            if not section:
                # Error if so
                utils.error('Section is null')
            else:
                # Now check if the current round is 0
                if section.current_round == 0:
                    # And redirect to an error if so
                    self.redirect('/error?code=103')
                else:
                    # Otherwise, we need to set our template values
                    self.render_template(student, section)
Beispiel #5
0
    def post(self):
        """
        HTTP POST method to add the student.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # So first we need to get at the course and section
        course, section = utils.get_course_and_section_objs(self.request, instructor)
        # And grab the action from the page
        action = self.request.get('action')
        # Check that the action was actually supplied
        if not action:
            # Error if not
            utils.error('Invalid arguments: course_name or section_name or actoin is null', handler=self)
        else:
            # Now switch on the action
            if action == 'add':
                # Grab a list of the emails from the page
                emails = json.loads(self.request.get('emails'))
                # And create new students from that list
                self.add_students(section, emails)
            elif action == 'remove':
                # Grab the email from the page to remove
                email = self.request.get('email').lower()
                # And remove it
                self.remove_student(section, email)
            else:
                # Send an error if any other action is supplied
                utils.error('Unexpected action: ' + action, handler=self)
Beispiel #6
0
    def get(self):
        """
        HTTP GET method to retrieve the responses.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Create logout url
        logout_url = users.create_logout_url(self.request.uri)
        # And grab the course and section name from the page
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # And grab all the other courses and sections for this instructor
        template_values = utils.get_template_all_courses_and_sections(
            instructor, course_name, selected_section_name)
        # Now check that the section from the webpage actually corresponded
        # to an actual section in this course, and that the template was set
        if 'selectedSectionObject' in template_values:
            # If so, grab that section from the template values
            current_section = template_values['selectedSectionObject']
            # And set the round
            template_values['round'] = current_section.rounds
            # Create a new dict for the responses
            resp = {}
            # And loop over the number of rounds (indexed at 1 for initial)
            for i in range(1, current_section.rounds + 1):
                # if seq. discussion and round==2, grab all the groups
                if not current_section.has_rounds and i == 2:
                    # extract all responses in each group
                    groups = model.Group.query(
                        ancestor=current_section.key).fetch()
                    all_seq_responses = []
                    for g in groups:
                        seq_responses = model.SeqResponse.query(
                            ancestor=g.key).order(
                                model.SeqResponse.index).fetch()
                        all_seq_responses += seq_responses
                    template_values['seq_responses'] = all_seq_responses
                else:
                    round_i = model.Round.get_by_id(i,
                                                    parent=current_section.key)
                    response = model.Response.query(
                        ancestor=round_i.key).fetch()
                    # response is a list of all the responses for the round i
                    if response:
                        resp[str(i)] = response
                    # Add the responses to the template values
                    template_values['responses'] = resp
        # end
        # And set the template and render the page
        template_values['logouturl'] = logout_url
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        template = utils.jinja_env().get_template('instructor/responses.html')
        self.response.write(template.render(template_values))
Beispiel #7
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/txt'
     # out = self.makeit()
     # self.response.write(out.getvalue())
     instructor_tmp = utils.check_privilege(model.Role.instructor)
     writer = csv.writer(self.response.out)
     instructor = model.Instructor.get_by_id(instructor_tmp.email)
     course = model.Course.get_by_id(instructor.export_course,
                                     parent=instructor.key)
     section = model.Section.get_by_id(course.export_section,
                                       parent=course.key)
     students = section.students
     writer.writerow([
         instructor.export_course,
         course.export_section,
     ])
     selector = section.export_info
     selector = selector.split()
     count = 0
     export_rounds = {}
     print selector
     while count < len(selector):
         if int(selector[count]) in export_rounds.keys():
             export_rounds[int(selector[count])].append(
                 int(selector[count + 1]))
         else:
             export_rounds[int(selector[count])] = []
             export_rounds[int(selector[count])].append(
                 int(selector[count + 1]))
         count += 2
     print export_rounds
     rounds = model.Round.query(ancestor=section.key).fetch()
     for i in export_rounds.keys():
         writer.writerow([
             'This is student ' + students[i].email + ' :',
         ])
         for j in export_rounds[i]:
             writer.writerow([
                 'Round' + str(j),
             ])
             responses = model.Response.query(
                 ancestor=rounds[j - 1].key).fetch()
             for resp in responses:
                 if resp.student == students[i].email:
                     # print 'test@@@'
                     writer.writerow([
                         resp.student,
                         resp.comment,
                         resp.response,
                     ])
     # writer.writerow([instructor.export_course, course.export_section, instructor.email, ])
     print 'Hello!'
Beispiel #8
0
 def post(self):
     course_name = self.request.get('course')
     section_name = self.request.get('section')
     selector = self.request.get('action')
     # print selector
     instructor_tmp = utils.check_privilege(model.Role.instructor)
     instructor = model.Instructor.get_by_id(instructor_tmp.email)
     instructor.export_course = course_name.upper()
     course = model.Course.get_by_id(course_name, parent=instructor.key)
     course.export_section = section_name.upper()
     section = model.Section.get_by_id(section_name.upper(),
                                       parent=course.key)
     section.export_info = selector
     instructor.put()
     course.put()
     section.put()
Beispiel #9
0
    def post(self):
        """
        HTTP POST method to add a section to a course.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Otherwise, grab the course, section, and action from the webpage
        course_name = self.request.get('course')
        section_name = self.request.get('section')
        action = self.request.get('action')
        # Double check that all three were supplied
        if not course_name or not section_name or not action:
            # Error if not
            utils.error(
                'Invalid arguments: course_name or section_name or action is null',
                handler=self)
        else:
            # Otherwise, grab the course from the database
            course = model.Course.get_by_id(course_name.upper(),
                                            parent=instructor.key)
            # And check that it exists and is active
            if not course or not course.is_active:
                # Error if not
                utils.error(course_name + ' does not exist OR is not active!',
                            handler=self)
            else:
                # Otherwise, switch on the action
                if action == 'add':
                    # Add a new section if action is add
                    self.add_section(course, section_name.upper())
                elif action == 'toggle':
                    # Or toggle
                    self.toggle_section(course, section_name.upper())
                else:
                    # Error if the action is neither toggle or add
                    utils.error('Unexpected action:' + action, handler=self)
Beispiel #10
0
    def get(self):
        """
        HTTP GET Method to render the ``/groups`` page for the logged in Instructor.

        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Otherwise, create a logout url
        logout_url = users.create_logout_url(self.request.uri)
        # And get the course and section names from the page
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # Grab all the courses and sections for the logged in instructor
        template_values = utils.get_template_all_courses_and_sections(instructor,
                                                                      course_name.upper(),
                                                                      selected_section_name.upper())
        # Now check that the section from the webpage actually corresponded
        # to an actual section in this course, and that the template was set
        if 'selectedSectionObject' in template_values:
            # If so, grab that section from the template values
            current_section = template_values['selectedSectionObject']
            # Check that the current section has at least one round
            if current_section.rounds > 0:

                # Grab the responses from the initial question
                response = model.Response.query(
                    ancestor=model.Round.get_by_id(1, parent=current_section.key).key).fetch()

                no_answer_students = []
                # And loop over the students in this section
                for stu in current_section.students:
                    flag = True
                    # Loop over the responses
                    for res in response:
                        # And check when the response matches the student
                        if res.student == stu.email:
                            # And set the group of the response to the
                            # group of the student who made that response
                            res.group = stu.group
                            flag = False
                            # end
                    # end
                    if flag:
                        no_answer_students.append(stu)
                # end
                # Add the responses and current group to the template values
                template_values['no_answer_students'] = no_answer_students
                template_values['responses'] = response
                template_values['group'] = current_section.groups
                # end
        # end
        # Set the template and render the page
        template_values['logouturl'] = logout_url
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        template = utils.jinja_env().get_template('instructor/groups.html')
        self.response.write(template.render(template_values))
Beispiel #11
0
    def get(self):
        instructor_tmp = utils.check_privilege(model.Role.instructor)
        instructor = model.Instructor.get_by_id(instructor_tmp.email)
        course = model.Course.get_by_id(instructor.export_course,
                                        parent=instructor.key)
        section = model.Section.get_by_id(course.export_section,
                                          parent=course.key)
        students = section.students
        selector = section.export_info
        selector = selector.split()
        count = 0
        export_rounds = {}
        # print selector
        while count < len(selector):
            if int(selector[count]) in export_rounds.keys():
                export_rounds[int(selector[count])].append(
                    int(selector[count + 1]))
            else:
                export_rounds[int(selector[count])] = []
                export_rounds[int(selector[count])].append(
                    int(selector[count + 1]))
            count += 2
        # print export_rounds
        rounds = model.Round.query(ancestor=section.key).fetch()
        template_values = {}
        output_students = []
        output_seq_rounds = {}
        output_options = {}
        output_comments = {}
        output_responses = {}
        output_summary = {}
        # export_rounds contain {key, value}, where key is student and value is round
        for i in export_rounds.keys():
            output_students.append(students[i])
            output_seq_rounds[students[i].email] = []
            output_options[students[i].email] = []
            output_comments[students[i].email] = []
            output_responses[students[i].email] = []
            output_summary[students[i].email] = []
            for j in export_rounds[i]:
                output_seq_rounds[students[i].email].append(j)
                flag = False
                if section.has_rounds:  # TODO Also for last and first round in seq
                    responses = model.Response.query(
                        ancestor=rounds[j - 1].key).fetch()
                    for resp in responses:
                        utils.log('resp = ' + str(resp))
                        if resp.student == students[i].email:
                            output_options[students[i].email].append(
                                resp.option)
                            output_comments[students[i].email].append(
                                resp.comment)
                            output_responses[students[i].email].append(
                                resp.response)
                            output_summary[students[i].email].append(
                                resp.summary)
                            flag = True
                    if not flag:
                        output_options[students[i].email].append('NA')
                        output_comments[students[i].email].append('NA')
                        output_responses[students[i].email].append('NA')
                        output_summary[students[i].email].append('NA')
                else:
                    responses = model.SeqResponse.query(
                        ancestor=rounds[j - 1].key).fetch()
                    utils.log('responses = ' + str(responses))
                    for resp in responses:
                        utils.log('resp = ' + str(resp))
                        if resp.author == students[i].email:
                            output_options[students[i].email].append('NA')
                            output_comments[students[i].email].append(
                                resp.text)
                            output_responses[students[i].email].append('NA')
                            output_summary[students[i].email].append('NA')
                            flag = True
                        if not flag:
                            output_options[students[i].email].append('NA')
                            output_comments[students[i].email].append('NA')
                            output_responses[students[i].email].append('NA')
                            output_summary[students[i].email].append('NA')

        template_values['students'] = output_students
        template_values['seq_rounds'] = output_seq_rounds
        template_values['comments'] = output_comments
        template_values['responses'] = output_responses
        template_values['option'] = output_options
        template_values['summary'] = output_summary
        template = utils.jinja_env().get_template(
            'instructor/show_html_responses.html')
        self.response.write(template.render(template_values))
Beispiel #12
0
    def post(self):
        """
        HTTP POST method to submit the response.
        """
        # First, check that the logged in user is a student
        student = utils.check_privilege(model.Role.student)
        if not student:
            # Redirect home if not a student
            return self.redirect('/home')
        # end

        # First, grab the section key from the page
        section_key = self.request.get('section')
        # Double check that we actually got a section key
        if section_key:
            try:
                # Grab the section from the database
                section = ndb.Key(urlsafe=section_key).get()
                # And double check that it's valid

                if section:
                    # Grab the current round from the database
                    current_round = model.Round.get_by_id(section.current_round, parent=section.key)
                    # And double check that it's valid
                    if current_round:
                        # If this is a quiz round or if this section has roudns based discussions,
                        # save it in the usual way
                        if section.has_rounds or current_round.is_quiz:
                            self.save_submission(student, current_round)
                        else:
                            # Otherwise, save as a Seq Discussion
                            # 1. Make sure the author email passed from view is same as current student's email
                            author_email = student.email
                            student_info = utils.get_student_info(author_email, section.students)
                            group_id = student_info.group
                            group = model.Group.get_by_id(id=group_id, parent=section.key)

                            # 2. create the post in that group
                            if group:
                                post = model.SeqResponse(parent=group.key)
                                post.author = author_email
                                post.author_alias = student_info.alias
                                post.timestamp = str(datetime.datetime.now())
                                post.text = self.request.get('text')
                                post.index = group.num_seq_responses + 1
                                post.put()
                                group.num_seq_responses += 1
                                group.put()
                                utils.log('Post created:' + str(post))
                            else:
                                utils.error('Group is null')
                    else:
                        utils.error('Sorry! The round is not visible, please try again later.', handler=self)
                else:  # section is null
                    utils.error('Section is null', handler=self)
            except Exception as e:
                utils.error(
                    'Sorry! There was some error submitting your response please try again later. Exception: ' + e.message,
                    handler=self)  # TODO: use exceptions in all classes?
        else:
            utils.error('Invalid Parameters: section_key is null', handler=self)
Beispiel #13
0
    def post(self):
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Now let's grab the action from the page
        action = self.request.get('action')
        # And check that it was actually passed
        if not action:
            # Error if not
            utils.error('Error! Invalid arguments: action is null',
                        handler=self)
        else:
            # Now switch on the action
            if action == 'add':
                # Only the lead-in or summary are listed as an 'add' action
                self.add_leadin_summary(instructor)
            elif action == 'end-current-round':
                self.end_current_round(instructor)
            elif action == 'add_disc':
                # Now, let's grab the number of rounds and duration from page
                num_of_rounds = int(self.request.get('total_discussions'))
                duration_of_round = int(self.request.get('duration'))
                # And grab the buffer time between rounds
                buffer_bw_rounds = 0  # int(self.request.get('buffer_time'))

                # Get the type based on whether it's a rounds based discussion or sequential
                course, section = utils.get_course_and_section_objs(
                    self.request, instructor)
                # round_type = model.Round.get_round_type(
                #     'discussion') if section.has_rounds else model.Round.get_round_type('sequential')
                round_type = 2 if section.has_rounds else 3
                # Send the number and duration to the add rounds function
                self.add_rounds(num_of_rounds=num_of_rounds,
                                duration=duration_of_round,
                                instructor=instructor,
                                type=round_type,
                                buffer_bw_rounds=buffer_bw_rounds)
            elif action == 'delete':
                # Send the id of the round to be deleted
                round_id = int(self.request.get('round_id'))
                self.delete_round(instructor, round_id)
            elif action == 'change':
                # Send the id of the round to be edited
                round_id = int(self.request.get('round_id'))
                self.edit_round(instructor, round_id)
            elif action == 'start':
                # Simply kick off the first round
                self.start_rounds(instructor)
                # Send mail to students
                # Grab section object and instructor email to pass to email function
                email_course, email_section = utils.get_course_and_section_objs(
                    self.request, instructor)
                # Grab the message of the email
                message = self.request.get('message')
                # Grab the subject of the email
                subject = self.request.get('subject')
                to_emails = [s.email for s in email_section.students]
                utils.send_mails(to_emails, subject, message)
                email_course.recent_section = email_section.name
                email_course.put()
            elif action == 'toggle_anon':
                self.toggle_anonymity(instructor)
            elif action == 'toggle_round_structure':
                self.toggle_round_structure(instructor)
            else:
                # Send an error if any other action is supplied
                utils.error('Error! Unexpected action: ' + action,
                            handler=self)
Beispiel #14
0
    def get(self):
        """
        HTTP GET method to retrieve the rounds.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # Now create a logout url
        logout_url = users.create_logout_url(self.request.uri)
        # Grab the course and section name from the webpage
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # And get all the courses and sections for this instructor
        template_values = utils.get_template_all_courses_and_sections(
            instructor, course_name.upper(), selected_section_name.upper())
        # Add the name of the current/local timezone to the template.
        template_values['tz'] = utils.tzname()
        # Now check that the section from the webpage actually corresponded
        # to an actual section in this course, and that the template was set
        if 'selectedSectionObject' in template_values:
            # If so, grab that section from the template values
            current_section = template_values['selectedSectionObject']
            # Set the current active round
            template_values['activeRound'] = current_section.current_round
            # Send the current time stamp back to the view to do comparisons with
            template_values['now'] = datetime.datetime.now()
            # And grab all the rounds for this section
            # rounds = model.Round.query(ancestor=current_section.key).filter(model.Round.type != 4).fetch()
            rounds = model.Round.fetch_real_rounds(current_section.key)
            # Double check that there are actually rounds already created
            if rounds:
                # And set the template values
                template_values['rounds'] = rounds
                # Create an empty list to hold the discussion rounds
                discussion_rounds = []
                # And loop over all of the rounds for this section
                for r in rounds:
                    # Set the initial question
                    if r.number == 1:
                        template_values['initialQuestion'] = r
                    elif r.is_quiz:
                        # And if not the lead-in question, but still a quiz
                        # it must be the summary round
                        template_values['summaryQuestion'] = r
                    else:
                        # Otherwise, it's just a discussion round
                        discussion_rounds.append(r)
                        # end
                # end
                # Set the discussion round template values
                template_values['discussionRounds'] = discussion_rounds
            # end
            # Check to see if the summary round was set in the template
            if 'summaryQuestion' in template_values:
                # If so, set the next round to the total number of rounds
                template_values['nextRound'] = current_section.rounds
            else:
                # Otherwise, it must be set to the number of rounds plus
                # one (to account for the eventual summary round)
                template_values['nextRound'] = current_section.rounds + 1
                # end
                template_values['anon'] = current_section.is_anonymous
                template_values['round_structure'] = current_section.has_rounds

        # end
        # Set the template and render the page
        template_values['logouturl'] = logout_url
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        template = utils.jinja_env().get_template('instructor/rounds.html')
        self.response.write(template.render(template_values))
Beispiel #15
0
    def get(self):
        """
        HTTP GET method to retrieve the group responses.
        """
        # First, check that the logged in user is an instructor
        instructor = utils.check_privilege(model.Role.instructor)
        if not instructor:
            # Send them home and short circuit all other logic
            return self.redirect('/')
        # end

        # TODO: Display seq. responses, like in response.py

        # Otherwise, create a logout url
        logout_url = users.create_logout_url(self.request.uri)
        # And get the course and section name from the page
        course_name = self.request.get('course')
        selected_section_name = self.request.get('section')
        # And grab the other courses and sections from this instructor
        template_values = utils.get_template_all_courses_and_sections(
            instructor, course_name, selected_section_name)
        # Now check that the section from the webpage actually corresponded
        # to an actual section in this course, and that the template was set
        if 'selectedSectionObject' in template_values:
            # If so, grab the current section from the template values
            current_section = template_values['selectedSectionObject']
            # Set the rounds and groups
            template_values['round'] = current_section.rounds
            template_values['groups'] = current_section.groups
            # And check that groups have actually been assigned
            if current_section.groups > 0:
                # Create a new dict for responses
                resp = {}
                # Loop over the groups (indexed by 1)
                for g in range(1, current_section.groups + 1):
                    # And loop over the rounds (indexed by 1)
                    for r in range(1, current_section.rounds + 1):
                        # Now set an empty list for each group and round
                        resp['group_' + str(g) + '_' + str(r)] = []
                        # end
                # end
                # Loop over the number of rounds (indexed by 1)
                for r in range(1, current_section.rounds + 1):
                    # Grab the responses for that round from the db
                    responses = model.Response.query(
                        ancestor=model.Round.get_by_id(r, parent=current_section.key).key).fetch()
                    # Double check that the responses actually exist
                    if responses:
                        # And loop over the responses
                        for res in responses:
                            # And loop over the students in this section
                            for s in current_section.students:
                                # Check that the email of the student
                                # and the email of the response match
                                # and that the student is in a group
                                if s.email == res.student and s.group != 0:
                                    # Set the alias of the response
                                    res.alias = s.alias
                                    # Append the response to the appropriate
                                    # group and round
                                    resp['group_' + str(s.group) + '_' + str(r)].append(res)
                                    break
                                    # end
                                    # end
                                    # end
                                    # end
                # end
                # And set the template values for all the responses
                template_values['responses'] = resp
                # end
        # end
        # And set the template and render the page
        template_values['logouturl'] = logout_url
        from src import config
        template_values['documentation'] = config.DOCUMENTATION
        template = utils.jinja_env().get_template('instructor/groups_responses.html')
        self.response.write(template.render(template_values))