예제 #1
0
    def create_large_educatives_and_seminar(cls):
        NUMBER_OF_KENS = 50
        NUMBER_OF_EDUCATIVES = 900
        NUMBER_OF_HUGS = 45
        NUMBER_OF_VEGETARIAN_HUGS = 8

        kens = []
        for i in xrange(NUMBER_OF_KENS):
            ken = Ken()
            ken.name = "Ken " + str(i)
            kens.append(ken)
            cls.session.add(ken)

        educatives = []
        for i in xrange(NUMBER_OF_EDUCATIVES):
            educative = Educative()
            if random.randint(0, 2) == 0:
                educative.gender = MALE
            else:
                educative.gender = FEMALE
            if random.randint(0, 9) == 0:
                educative.food = VEGETARIAN
            else:
                educative.food = MEAT
            educative.first_name = "Educative"
            educative.last_name = str(i)
            educative.ken = kens[random.randint(0, NUMBER_OF_KENS - 1)]
            educatives.append(educative)
            cls.session.add(educative)

        seminar = Seminar()
        seminar.name = 'Seminar'
        cls.session.add(seminar)

        camp1, camp2, camp3 = Camp(), Camp(), Camp()
        camp1.name = 'Camp 1'
        camp2.name = 'Camp 2'
        camp3.name = 'Camp3'
        seminar.camps += [camp1, camp2, camp3]
        [cls.session.add(c) for c in seminar.camps]

        hugs = []
        for i in xrange(NUMBER_OF_HUGS):
            hug = Hug()
            hug.name = "Hug " + str(i)
            hug.camp = seminar.camps[i % 3]
            if i < NUMBER_OF_VEGETARIAN_HUGS:
                hug.food = VEGETARIAN
            hugs.append(hug)
            cls.session.add(hug)
            for j in xrange(random.randint(1, 2)):
                madrich = Madrich()
                madrich.first_name = "Madrich"
                madrich.last_name = str(j)
                madrich.ken = kens[random.randint(0, NUMBER_OF_KENS - 1)]
                hug.madrichim.append(madrich)
                cls.session.add(madrich)

        return educatives, seminar
예제 #2
0
    def create_seminar(self, num_of_camps, num_of_hugs):
        seminar = Seminar()
        seminar.name = 'Seminar'
        self.session.add(seminar)
        for i in xrange(num_of_camps):
            camp = Camp()
            camp.name = 'Camp ' + str(i)
            camp.seminar = seminar
            self.session.add(camp)

        for i in xrange(num_of_hugs):
            hug = Hug()
            hug.name = 'Hug ' + str(i)
            hug.camp = seminar.camps[i % num_of_camps]
            self.session.add(hug)

        self.session.flush()
        return seminar
예제 #3
0
    def create_small_educatives_and_seminar(cls):
        misgav = Ken()
        misgav.name = 'Misgav'
        cls.session.add(misgav)

        karmiel = Ken()
        karmiel.name = 'Karmiel'
        cls.session.add(karmiel)

        aviad = Educative()
        aviad.gender = MALE
        aviad.first_name = "Aviad"
        aviad.ken = misgav
        cls.session.add(aviad)

        naama = Educative()
        naama.gender = FEMALE
        naama.first_name = "Naama"
        naama.ken = karmiel
        cls.session.add(naama)

        inbar = Educative()
        inbar.gender = FEMALE
        inbar.first_name = "Inbar"
        inbar.ken = misgav
        cls.session.add(inbar)

        alon = Educative()
        alon.gender = MALE
        alon.first_name = "Alon"
        alon.ken = karmiel
        cls.session.add(alon)

        seminar = Seminar()
        cls.session.add(seminar)

        camp = Camp()
        camp.seminar = seminar
        cls.session.add(camp)

        hug1 = Hug()
        hug1.name = "Hug1"
        hug1.camp = camp
        cls.session.add(hug1)

        hug2 = Hug()
        hug2.name = "Hug2"
        hug2.camp = camp
        cls.session.add(hug2)

        return [aviad, naama, inbar, alon], seminar