예제 #1
0
 def defaultTest(self):
     q = Question("abcacb")
     db.session.add(q)
     db.session.commit()
     self.assertEqual(q.nu_maybe, 0)
     self.assertEqual(q.nu_no, 0)
     self.assertEqual(q.nu_yes, 0)
예제 #2
0
파일: survey.py 프로젝트: ailan12345/app1
def populate():
    print('Populating Survey and Question ... ', end='')
    Survey.objects.all().delete()
    Question.objects.all().delete()
    Choice.objects.all().delete()
    Response.objects.all().delete()
    userList = User.objects.first()
    for title in titles:
        survey = Survey()
        survey.title = title
        survey.description = title
        survey.date = datetime.date.today()
        survey.startDate = survey.date
        survey.endDate = survey.startDate + datetime.timedelta(60)
        survey.user = userList
        survey.emailContent = '新的問題開始'
        survey.save()
        for content in contents:
            question = Question()
            question.survey = survey
            question.title += 'Q:' + title
            question.description += title + content + '\n'
            question.save()
            Choice.objects.create(question=question, name='是')
            Choice.objects.create(question=question, name='否,另有要事')
    print('done')
예제 #3
0
파일: views.py 프로젝트: hoanguyen401/flask
def add():
    if request.form['text'].strip() != '':
        newQ = Question(question_text = request.form['text'])
        db.session.add(newQ)
        db.session.commit()
        message = "Question is created"
    else:
        message = "Pool question is full"    
    context = {"questions": Question.query.all(), "Message": message}
    return render_template('index.html', **context)
예제 #4
0
def create_questions():
    if request.form["question_text"].strip() != "":
        new_question = Question(question_text=request.form["question_text"])
        db.session.add(new_question) 
        db.session.commit()
        message = "Succesfully added a new poll!"
    else:
        message = "Poll question should not be an empty string!"

    context = {'questions': Question.query.all(), 'message': message}
    return render_template('index.html', **context) 
예제 #5
0
def get_question_qa():
    current_term = _term.get_cur_term()
    areas = []
    groups = _checkpoint.get_project_cp_group_list(constant.current_project_id)
    for cp in groups:
        area = areaitem(cp.name, cp.desc)
        area.qas = _get_question_qa_by_cid(cp.name)
        area.qas.sort(lambda x, y:comparcid(x, y))
        if cp.name == 'G':
            question = Question()
            question.cid = 'G49b'
            question.title = u'有待改进的地方→'
            area.qas.insert(0, question)
            question = Question()
            question.cid = 'G49a'
            question.title = u'做得比较好的地方→'
            area.qas.insert(0, question)
            question = Question()
            question.cid = ''
            question.title = u'除了以上这些评价的问题之外,经销商的表现有没有您认为做得比较好的地方或有待改进的地方?'
            area.qas.insert(0, question)
            
        areas.append(area)
    return areas, current_term
예제 #6
0
    def setUp(self):
        self.Sv = Survey()
        self.Sv.name = "Plantas"
        self.Sv.description = "ya jale todo"
        self.Sv.save()

        self.Qs = Question()
        self.Qs.question_text = "¿es GG?"
        self.Qs.survey = self.Sv

        self.Rs = Response()
        self.name = "Carlos"
        self.survey = self.Sv

        self.BRs = BaseResponse()
        self.BRs.response = self.Rs
        self.BRs.question = self.Qs
        self.BRs.response_text = "Al año con fuerza"
예제 #7
0
#
#

yes_no_cats = lambda: [
    Category(text=emojize('Да :smile:')),
    Category(text=emojize('Нет :pensive:'))
]

three_scale_cats = lambda: [
    Category(text=emojize('Да, все четко! :thumbsup:')),
    Category(text=emojize('На троечку, порядка не хватает :grin:')),
    Category(text=emojize('Все плохо, хочется убежать :scream:'))
]


q = Question()
q.code = 'q1'
q.type = types.info
q.text = emojize('Привет, исследователь! Надеюсь, твой гаджет хорошо заряжен, и в нем достаточно свободной памяти.\nТебе предстоит сделать много фоток и нагулять хороший аппетит :smile: \nБудь внимателен! Посмотри дважды, прежде чем ответить или сделать фото :eyes: \nЕсли сомневаешься, все равно фоткай. Да пребудет с тобой Сила Киноа! :raised_hands:')
save(q)

q = Question()
q.code = 'q2'
q.type = types.location
q.text = emojize('Нажми на кнопку, чтобы отправить геолокацию, и я узнаю, в каком ты сейчас магазине :round_pushpin:')
cats = [Category(text='Отправить местоположение'), ]
q.categories = cats
save(q)


q = Question()