コード例 #1
0
ファイル: test_answer.py プロジェクト: igor-calic/poll
    def test_sorting_by_order(self):
        question_key = Question.create(text="Q1", order=1)
        Answer.create(question_key=question_key, text="Answer 1", value=1, order=3)
        Answer.create(question_key=question_key, text="Answer 2", value=2, order=1)
        Answer.create(question_key=question_key, text="Answer 3", value=3, order=2)

        answers = Answer.by_question(question_key)

        self.assertEquals(1, answers[0].order)
        self.assertEquals(2, answers[1].order)
        self.assertEquals(3, answers[2].order)
コード例 #2
0
ファイル: main.py プロジェクト: igor-calic/poll
    def init(self):
        Question.clear()
        Answer.clear()

        q1 = Question.create(text="Preferred date", order=1)
        Answer.create(question_key=q1, text="Thu 18/02", order=1, value=1)
        Answer.create(question_key=q1, text="Fri 19/02", order=2, value=2)
        Answer.create(question_key=q1, text="Sat 20/02", order=3, value=3)
        Answer.create(question_key=q1, text="Sun 21/02", order=4, value=4)
        Answer.create(question_key=q1, text="Mon 22/02", order=5, value=5)
        Answer.create(question_key=q1, text="Tue 23/02", order=6, value=6)
        Answer.create(question_key=q1, text="Wed 24/02", order=7, value=7)
        Answer.create(question_key=q1, text="Thu 25/02", order=8, value=8)
        Answer.create(question_key=q1, text="Fri 26/02", order=9, value=9)

        q2 = Question.create(text="Preferred place", order=2)
        Answer.create(question_key=q2, text="Reading", order=1, value=1)
        Answer.create(question_key=q2, text="Staines", order=2, value=2)
        Answer.create(question_key=q2, text="London", order=3, value=3)

        User.create('Igor')
        User.create('Justin')
        User.create('Michael')
        User.create('Adam')
        User.create('Victor')
        User.create('Yargi')
        User.create('Varun')

        return 200
コード例 #3
0
ファイル: main.py プロジェクト: igor-calic/poll
    def init(self):
        Question.clear()
        Answer.clear()

        q1 = Question.create(text="Preferred date", order=1)
        Answer.create(question_key=q1, text="Thu 18/02", order=1, value=1)
        Answer.create(question_key=q1, text="Fri 19/02", order=2, value=2)
        Answer.create(question_key=q1, text="Sat 20/02", order=3, value=3)
        Answer.create(question_key=q1, text="Sun 21/02", order=4, value=4)
        Answer.create(question_key=q1, text="Mon 22/02", order=5, value=5)
        Answer.create(question_key=q1, text="Tue 23/02", order=6, value=6)
        Answer.create(question_key=q1, text="Wed 24/02", order=7, value=7)
        Answer.create(question_key=q1, text="Thu 25/02", order=8, value=8)
        Answer.create(question_key=q1, text="Fri 26/02", order=9, value=9)

        q2 = Question.create(text="Preferred place", order=2)
        Answer.create(question_key=q2, text="Reading", order=1, value=1)
        Answer.create(question_key=q2, text="Staines", order=2, value=2)
        Answer.create(question_key=q2, text="London", order=3, value=3)

        User.create('Igor')
        User.create('Justin')
        User.create('Michael')
        User.create('Adam')
        User.create('Victor')
        User.create('Yargi')
        User.create('Varun')

        return 200