Exemple #1
0
    def register(cls):
        """
        register a new client
        :return: Client instance
        """

        client = Client()
        cls._key_private[client.private_id] = client.client_id
        client.set_exp(timedelta(minutes=5).seconds)
        cls._scheduler.add(client)
        return client
Exemple #2
0
def fill_database(self):
    #
    # Candidates
    #
    cand1 = Candidate(first_name="John",
                      last_name="Doe",
                      email="*****@*****.**",
                      birthday=datetime.date(1979, 3, 4),
                      phone="1-233-332",
                      languages='{ "English": "mother tongue", '
                      '  "French" : "beginner" }',
                      skills=".NET JavaScript Python Node.js MySQL")
    cand2 = Candidate(first_name="Jane",
                      last_name="Doe",
                      email="*****@*****.**",
                      birthday=datetime.date(1984, 7, 9),
                      phone="1-737-372",
                      languages='{ "English": "mother tongue", '
                      '  "French" : "beginner",'
                      '  "German" : "intermediate" }',
                      skills="Ruby Java PHP CakePHP")
    cand3 = Candidate(
        first_name="Bob",
        last_name="Coder",
        email="*****@*****.**",
        birthday=datetime.date(1988, 11, 3),
        phone="1-113-333",
        languages='{ "English": "mother tongue", '
        '  "Japanese" : "beginner",'
        '  "Swedish" : "intermediate" }',
        skills=
        "Electrical Engineering High Voltage Ruby Java JavaScript MongoDB Oracle PHP"
    )

    self.session.add(cand1)
    self.session.add(cand2)
    self.session.add(cand3)
    self.session.commit()

    #
    # Recruiters
    #
    recr1 = Recruiter(first_name="Bill", last_name="Oak", phone="1-454-998")
    recr2 = Recruiter(first_name="Vanessa",
                      last_name="Albright",
                      phone="1-119-238")
    recr3 = Recruiter(first_name="Kate",
                      last_name="Mingley",
                      phone="2-542-977")
    self.session.add(recr1)
    self.session.add(recr2)
    self.session.add(recr3)
    self.session.commit()

    #
    # Clients
    #
    client1 = Client(name="Capital Inc.",
                     phone="326-554-975",
                     email="*****@*****.**")
    client2 = Client(name="Red Black Tree Inc",
                     phone="121-554-775",
                     email="*****@*****.**")
    client3 = Client(name="My House Builder Company",
                     phone="663-514-075",
                     email="*****@*****.**")
    self.session.add(client1)
    self.session.add(client2)
    self.session.add(client3)
    self.session.commit()

    #
    # Positions
    #
    cl1_pos1 = Position(
        name="Python developer",
        description=
        "Our company needs a highly experienced senior Python developer with "
        "skills in large Python code handling.",
        tech_skills="Python SQLAlchemy GIT SVN OOP",
        years_of_experience=7,
        salary=65000,
        client=client1.id,
        recruiter=recr1.id)

    cl1_pos2 = Position(
        name="Ruby developer",
        description="Our company needs an experienced Ruby web developer with "
        "skills in CSS and JavaScript.",
        tech_skills="Ruby CSS JavaScript",
        years_of_experience=3,
        salary=58000,
        client=client1.id,
        recruiter=recr1.id)
    # Client 2
    cl2_pos1 = Position(
        name="Electrical Engineer",
        description="Our company needs an expert on Electrical Engineering.",
        tech_skills="Physics Electricity Engineering Planning ",
        years_of_experience=10,
        salary=85000,
        client=client2.id,
        recruiter=recr2.id)
    cl2_pos2 = Position(
        name="Carpenter",
        description="We are looking for a carpenter with experience in Alaska.",
        tech_skills="Carpenter Wood-Structure Scaffold Shelving",
        years_of_experience=6,
        salary=61000,
        client=client2.id,
        recruiter=recr2.id)

    # Client 3
    cl3_pos1 = Position(
        name="Txi driver",
        description="Our company needs Taxi Drivers in Boston.",
        tech_skills="Taxi-license Car Driver-license",
        years_of_experience=2,
        salary=45000,
        client=client3.id,
        recruiter=recr3.id)
    cl3_pos2 = Position(
        name="Mason",
        description=
        "We are looking for a mason who has experience working with clay",
        tech_skills="Masonary Clay Building Planning",
        years_of_experience=3,
        salary=43000,
        client=client3.id,
        recruiter=recr3.id)
    self.session.add(cl1_pos1)
    self.session.add(cl1_pos2)
    self.session.add(cl2_pos1)
    self.session.add(cl2_pos2)
    self.session.add(cl3_pos1)
    self.session.add(cl3_pos2)
    self.session.commit()

    #
    # Interviews
    #
    int1 = Interview(date=datetime.date(2015, 4, 3),
                     feedback="The candidate is perfect fit for the position.",
                     position=cl1_pos1.id,
                     recruiter_id=recr1.id,
                     candidate=cand1.id)
    int2 = Interview(date=datetime.date(2015, 6, 13),
                     feedback="The candidate is not good for the position.",
                     position=cl1_pos2.id,
                     recruiter_id=recr1.id,
                     candidate=cand2.id)
    int3 = Interview(date=datetime.date(2015, 7, 22),
                     feedback="The candidate is good for the position.",
                     position=cl2_pos1.id,
                     recruiter_id=recr2.id,
                     candidate=cand3.id)
    self.session.add(int1)
    self.session.add(int2)
    self.session.add(int3)

    self.session.commit()