Пример #1
0
 def export_course(course_id, export_answers=True):
     questions = Question.by_course_id(course_id)
     ret = []
     for question in questions:
         q = {'question': question.question}
         if export_answers:
             answers = AnswerModel.get_filtered(questionID=question.id)
             q['answers'] = []
             for x in answers:
                 q['answers'].append(x.text)
         ret.append(q)
     return ret
Пример #2
0
    def render_filtered_tbl(self,limit,offset,**kwargs):
        (answers, curpage, maxpages, startpage, pagecount) = \
                self.get_filtered(limit=limit, offset=offset)

        hasqid = ('questionID'in kwargs)
        course = g.lti.get_course_id()
        
        for a in answers:
            a.tags = ''
            tag_ids = AnswerTag.get_tag_ids(a.id)
            if tag_ids != []:           
                for id in tag_ids:
                    tag_name = Tag.get_tag(id)                     
                    a.tags += tag_name + ', ' 
                a.tags = a.tags[:-2]            

        return render_template('answer_filter_tbl.html',
                answers=answers,currentpage=curpage,
                maxpages=maxpages,startpage=startpage,pagecount=pagecount,
                hasQuestionID=hasqid,
                users=user.UserModel.get_all(),
                questions = [] if hasqid else Question.by_course_id(course))
Пример #3
0
 def export_course(course_id):
     questions = Question.by_course_id(course_id)
     return [{'question': question.question} for question in questions]