Exemple #1
0
def main():
    # create a recruiter object and populate its properties with values
    recruiter = Recruiter('Anna', 'Bee', '*****@*****.**', '+380956667777', 100, 3)
    # create and populate 2 Programmer objects
    programmer = Programmer('Dmitriy', 'Miller', '*****@*****.**', '+380956666969', 200,
                            ['Python', 'Django', 'PSQL', 'Linux', 'Bash'], 17)
    programmer2 = Programmer('Guy', 'Fieri', '*****@*****.**', '+3806798766990', 130, ['JS', 'HTML', 'CSS', 'PSQL'], 13)
    # create and populate 3 Candidate objects
    candidate = Candidate('John Doe', '*****@*****.**', ['Python', 'PSQL'], 'Python', 'Junior')
    candidate2 = Candidate('Jane Doe', '*****@*****.**', ['JS', 'HTML', 'CSS'], 'JS', 'Middle')
    candidate3 = Candidate('John Don\'t', '*****@*****.**', ['Java', 'SQL'], 'Java', 'Senior')
    # create and populate 2 Vacancy options
    vacancy = Vacancy('Junior Python Developer', 'Python', 'Junior')
    vacancy2 = Vacancy('Senior Java Developer', 'Java', 'Senior')

    # Various tests for existing methods:
    # print out a string indicating that the employee is working
    print(programmer.work())
    # print out the string representation of this Employee object
    print(programmer.__str__())
    # print out the number of people the recruiter hired this month
    print(recruiter.hired_this_month)
    # print out the tech stack and the number of closed issues for the first programmer
    print("Tech Stack: {}.\nClosed this month: {}.".format(", ".join(programmer.tech_stack),
                                                           programmer.closed_this_month))
    # create an "alpha" Programmer object and print out its properties along with values
    print(vars(programmer + programmer2))
    # compare two programmers by the numbers of the technologies they can work with
    # this one returns True
    print(programmer >= programmer2)
    # calculate total wages for an Employee for the current month
    print(programmer.current_salary())
Exemple #2
0
def main():
    # create a recruiter object and populate its properties with values
    recruiter = Recruiter('Anna', 'Bee', '*****@*****.**',
                          '+380956667777', 100, 3)
    # create and populate 2 Programmer objects
    programmer = Programmer('Dmitriy', 'Miller', '*****@*****.**',
                            '+380956666969', 200,
                            ['Python', 'Django', 'PSQL', 'Linux', 'Bash'], 17)
    programmer2 = Programmer('Guy', 'Fieri', '*****@*****.**', '+3806798766990',
                             130, ['JS', 'HTML', 'CSS', 'PSQL'], 13)
    # create and populate 3 Candidate objects
    candidate = Candidate('John Doe', '*****@*****.**', ['Python', 'PSQL'],
                          'Python', 'Junior')
    candidate2 = Candidate('Jane Doe', '*****@*****.**',
                           ['JS', 'HTML', 'CSS'], 'JS', 'Middle')
    candidate3 = Candidate('John Don\'t', '*****@*****.**', ['Java', 'SQL'],
                           'Java', 'Senior')
    # create and populate 2 Vacancy options
    vacancy = Vacancy('Junior Python Developer', 'Python', 'Junior')
    vacancy2 = Vacancy('Senior Java Developer', 'Java', 'Senior')
    """
    Tests for hw17:
    """
    # candidate3.work()
    """
Exemple #3
0
def main():
    rec1 = Recruiter('Andrew', '*****@*****.**', 200)
    prog1 = Programmer("Ivan", '*****@*****.**', 100)
    prog2 = Programmer('Vladimir', '*****@*****.**', 100)
    cand1 = Candidate('Sofia', '*****@*****.**', None, "oiu", 5)
    cand2 = Candidate('Ann', '*****@*****.**', None, "oiu", 5)
    cand3 = Candidate('Kate', '*****@*****.**', None, "oiu", 5)

    validate([rec1, prog1, prog2, cand1, cand2, cand3])
Exemple #4
0
def candidate():

    # {
    # "candidate_name": "Uriel Yair",
    # "candidate_skills": [ "Python", "Java", "React.js", "JavaScript" ]
    # }

    # curl -i -H "Content-Type: application/json" -X POST -d '{"candidate_name": "Uriel Yair", "candidate_skills": [ "Python", "Java", "React.js", "JavaScript" ]}' http://localhost:5000/candidate

    data = request.json

    new_candidate = Candidate(title=data["candidate_name"])

    for skill_name in data["candidate_skills"]:
        # Find skill in DB:
        skill = Skill.query.filter_by(name=skill_name).first()

        # check if skill already in DB:
        exists = skill is not None
        if not exists:
            # Create new skill row in DB
            skill = Skill(name=skill_name)
            db.session.add(skill)  # store in DB

        # add required skill to job opening
        new_candidate.skills.append(skill)

    db.session.add(new_candidate)
    db.session.commit()

    return candidate_schema.dump(new_candidate)
    def generate_candidates(self, nr):
        rnd_fn = self.generate_first_names(nr)
        rnd_ln = self.generate_last_names(nr)
        result = []

        for x in range(nr):
            experience = self.generate_experience(random.randint(1, 4), False)
            candidate = Candidate(rnd_fn[x], rnd_ln[x], experience)
            result.append(candidate)

        return [_.serialize() for _ in result]
Exemple #6
0
def reg_candidate():
    print("Inside candidate registeration")
    if request.method == 'POST':
        try:
            print("Here")
            voterId = int(request.form["voterId"].strip())
            print("Here2")
            electionId = int(request.form["electionId"].strip())
            print("Here3")
            name = request.form["name"].strip()
            print("Here4")
            manifesto = request.form["manifesto"].strip()
            print("==> checking Valid ID")
            if not check_valid_hostId(voterId):
                raise KeyError('Invalid hostId')

            print("==> Valid ID")
        except KeyError as e:
            return render_template("/candidate_reg.html")

        candidate = Candidate(voterId=voterId,
                              electionId=electionId,
                              name=name,
                              manifesto=manifesto)

        curr_session = db.session
        success = False

        try:
            curr_session.add(candidate)
            curr_session.commit()
            print(candidate)
            uId = candidate.uId
            print(uId)
            result = db.engine.execute(
                "INSERT INTO Vote (uId,electionId,count) VALUES (" + str(uId) +
                "," + str(electionId) + ", 0)")
            electionName = db.engine.execute(
                "SELECT electionName FROM Elections where electionId = " +
                str(electionId)).fetchone()
            electionName = electionName[0]
            success = True
        except Exception as err:
            print(err)

        if success:
            return render_template("/frontpage.html",
                                   display=getDisplay(),
                                   alert="Successfully Registered.")
        render_template("/candidate_reg.html")

    return render_template("/candidate_reg.html")
Exemple #7
0
from models.candidate import Candidate
from models.programmer import Programmer
from models.recruiter import Recruiter
from models.vacancy import Vacancy
from models.employee import Employee

P1 = Programmer("Julien Limeul", "*****@*****.**", "03044040440", 300)
P1.tech_stack = ["Perl", "C++", "Java"]
P2 = Programmer("Anatoliy Petrov", "*****@*****.**", "0533333", 50)
P2.tech_stack.append("PHP")

R1 = Recruiter("Anna Fateeva", "*****@*****.**", "06603030330303", 215)

C1 = Candidate("Alexandr Pushkin", "*****@*****.**",
               ["JS", "Python", "Ruby"], ["Ruby"], 134)
C2 = Candidate("Harry Potter", "*****@*****.**", ["C++", "C#"], ["С"], 12)
C3 = Candidate("Oleksii kozakevych", "*****@*****.**", ["Lua", "Python"],
               ["Php"], 10)

V1 = Vacancy("Junior Java Programmer", "Lua", 5)
V2 = Vacancy("Senior OpenStack Dev", "Python", 19)

print(P1.prop)
print(P2.chk_workdays())
print(Employee.chk_workdays())
                                 50,
                                 tech_stack="[C++,Java,C#]",
                                 closed_this_month=2)
    programmer_Ivan2 = Programmer("Ivan",
                                  "*****@*****.**",
                                  "12-12-12-2",
                                  60,
                                  tech_stack="[C++,Java,C#,SQL]",
                                  closed_this_month=5)
    if programmer_Ivan > programmer_Ivan2:
        print("More skills")
    else:
        print("Not more skills!")
    print(programmer_Ivan + programmer_Ivan2)

    candidate_1 = Candidate("Ivan Ivanov", "*****@*****.**", "[C#,C++]",
                            "[C++]", "middle")
    candidate_2 = Candidate("Petr Petrov", "*****@*****.**", "[Java,C++]",
                            "[Java]", "middle")
    candidate_3 = Candidate("Zhora Zhorov", "*****@*****.**", "[PHP,JS]",
                            "[PHP]", "middle")
    candidate_4 = Candidate("Zhora Zhorov", "*****@*****.**", "[PHP,JS]",
                            "[PHP]", "middle")
    print(candidate_1.full_name)
    print(candidate_2.email)
    print(candidate_3.main_skill)

    def check_emails3(persons):
        emails = []
        for i in persons:
            emails.append(i.email)
        if len(emails) > len(set(emails)):
Exemple #9
0
from models.candidate import Candidate
from models.programmer import Programmer
from models.recruiter import Recruiter
from models.vacancy import Vacancy

first_P = Programmer("Ivan Novikov", "*****@*****.**", "050", 30)
first_P.tech_stack = ["Python", "C++"]
second_P = Programmer("Ivan Ne_novikov", "*****@*****.**", "050", 50)
second_P.tech_stack.append("PHP")

first_R = Recruiter("Marina Laktionova", "*****@*****.**", "050", 20)

first_C = Candidate("Dmitriy Shmatko", "*****@*****.**",
                    ["Lua", "Python", "Puppet"], ["Lua"], 10)
second_C = Candidate("Anatoliy Laktionov", "*****@*****.**",
                     ["Lua", "Python", "Puppet"], ["Python"], 5)
third_C = Candidate("Igor Vnukov", "*****@*****.**",
                    ["Lua", "Python", "PHP"], ["Python"], 10)

first_V = Vacancy("Middle Python", "Python", 5)
second_V = Vacancy("Senior Python", "Python", 8)
def create_candidates_list(candidates_array):
    candidates_list = []
    for candidate in candidates_array:
        candidates_list.append(Candidate(candidate.get('id'), candidate.get('title'), candidate.get('skills_ids')))
    return candidates_list
Exemple #11
0
 def add_candidate(self, first_name, last_name):
     cand = Candidate(first_name, last_name, [])
     self.CANDIDATES.append(cand.serialize())
     return str(cand.id)