def setUp(self):
        self.item1 = Vacancy(
            title="closes today, less important",
            in_lists=True,
            published=True,
            date=datetime.now()
            )
        self.item1.save()

        self.item2 = Vacancy(
            title="closed 20 days ago, important",
            summary="a job for today",
            in_lists=True,
            published=True,
            date=datetime.now()-timedelta(days=20),
            importance=3,
            slug="item2"
            )
        self.item2.save()

        self.item3 = Vacancy(
            title="closes in the future",
            in_lists=True,
            published=True,
            date=datetime.now()+timedelta(days=20),
            importance=3,
            slug="item3"
            )
        self.item3.save()

        self.itemlist = List()
        self.itemlist.model = Vacancy
        self.itemlist.model_string = "vacancies"
        self.itemlist.items = Vacancy.objects.all()
    def add_vacancy(payload):
        try:
            body = request.get_json()

            new_job_title = body.get('job_title')
            new_job_description = body.get('job_description')
            new_requirements = body.get('requirements')
            new_benefits = body.get('benefits')
            new_city = body.get('city')
            new_region = body.get('region')
            new_min_salary = body.get('min_salary')
            new_date_posted = datetime.now()
            new_company_id = body.get('company_id')

            vacancy = Vacancy(job_title=new_job_title,
                              job_description=new_job_description,
                              requirements=new_requirements,
                              benefits=new_benefits,
                              city=new_city,
                              region=new_region,
                              min_salary=new_min_salary,
                              date_posted=new_date_posted,
                              company_id=new_company_id)

            vacancy.insert()
            return jsonify({'success': True})
        except Exception:
            print(sys.exc_info())
            abort(422)
    def setUp(self):
        self.item1 = Vacancy(
            title="closes today, less important",
            in_lists=True,
            published=True,
            date=datetime.now()
            )
        self.item1.save()

        self.item2 = Vacancy(
            title="closed 20 days ago, important",
            summary="a job for today",
            in_lists=True,
            published=True,
            date=datetime.now()-timedelta(days=20),
            importance=3,
            slug="item2"
            )
        self.item2.save()

        self.item3 = Vacancy(
            title="closes in the future",
            in_lists=True,
            published=True,
            date=datetime.now()+timedelta(days=20),
            importance=3,
            slug="item3"
            )
        self.item3.save()

        self.itemlist = FilterList()
        self.itemlist.model = Vacancy
        self.itemlist.request = HttpRequest()
class VacanciesTests(TestCase):
    def setUp(self):
        # Every test needs a client.
        self.client = Client()

        self.toothjob = Vacancy(
            title = "Pulling teeth",
            slug = "pulling-teeth",
            date = datetime.now() + timedelta(days=30),
            )

    def test_generic_attributes(self):
        self.toothjob.save()
        # the item has no informative content
        self.assertEqual(self.toothjob.is_uninformative, True)

        # there are no Entities in the database, so this can't be hosted_by anything
        self.assertEqual(self.toothjob.hosted_by, None)

        # since there are no Entities in the database, default to settings's template
        self.assertEqual(self.toothjob.get_template, settings.CMS_TEMPLATES[0][0])

    def test_date_related_attributes(self):
        self.toothjob.date = datetime(year=2012, month=12, day=12)
        self.assertEqual(self.toothjob.get_when, "December 2012")
示例#5
0
async def recieve_resume(message: types.Message, state: FSMContext):
    if message.document.mime_type == 'application/pdf':
        file_id = message.document.file_id
        file_path = settings.resumes_path_base + str(file_id) + '.pdf'
        await bot.download_file_by_id(file_id, file_path)
        text_pdf = parser_from_pdf.extract_text_from_pdf(file_path)
        json_obj = json.dumps(text_pdf)
        async with state.proxy() as s:
            vacancy_id = s['id']
        candidate = Candidate(user=User.get(User.chat_id == message.chat.id),
                              vacancy=Vacancy.get(Vacancy.id == vacancy_id),
                              resume_file_id=file_id,
                              resume_json=json_obj,
                              status='Резюме обрабатывается')
        candidate.save()
        await message.answer(messages.resume_in_treatment)
        treatment_result = await treatment_resume(candidate.id)
        if treatment_result:
            candidate.status = 'Резюме одобрено'
            candidate.save()
            await message.answer(messages.resume_is_good)
            vacancy = Vacancy.get(Vacancy.id == vacancy_id)
            if vacancy.test_task:
                keyboard = InlineKeyboardMarkup()
                keyboard.add(
                    InlineKeyboardButton(buttons.menu, callback_data='menu'))
                await bot.send_document(message.chat.id,
                                        open(vacancy.test_task, 'rb'),
                                        caption=messages.here_is_task,
                                        reply_markup=keyboard)
                candidate.status = 'Отправлено тестовое задание'
                candidate.save()
                await state.finish()
            else:
                keyboard = InlineKeyboardMarkup()
                keyboard.add(
                    InlineKeyboardButton(buttons.menu, callback_data='menu'))
                await message.answer(messages.there_is_no_task,
                                     reply_markup=keyboard)
                candidate.status = 'Контакты отправлены работодателю'
                candidate.save()
                # resume = json.loads(candidate.resume_json)['info']
                await bot.send_message(
                    candidate.vacancy.creator.chat_id,
                    messages.user_without_task.format(candidate.user.username,
                                                      candidate.vacancy.name))
                await state.finish()
        else:
            candidate.status = 'Резюме отклонено'
            candidate.save()
            await message.answer(messages.resume_is_bad)
            await FindVacancy.id.set()

    else:
        keyboard = InlineKeyboardMarkup()
        keyboard.add(
            InlineKeyboardButton(buttons.back,
                                 callback_data='back_to_find_vacancies'))
        await message.answer(messages.something_wrong, reply_markup=keyboard)
示例#6
0
async def delete_vacancy(query: callback_query):
    vacancy_id = int(query.data.split('_')[2])
    Vacancy.delete_by_id(vacancy_id)
    await bot.delete_message(query.message.chat.id, query.message.message_id)
    keyboard = InlineKeyboardMarkup()
    keyboard.add(InlineKeyboardButton(buttons.menu, callback_data='menu'))

    await query.message.answer(messages.deleted_vacancy, reply_markup=keyboard)
示例#7
0
def main():
    recruiter_1 = Recruiter('Bon Jovi', '*****@*****.**', 20)
    programmer_1 = Programmer('Jason Stathem', '*****@*****.**', 50)
    programmer_2 = Programmer('Vin Diesel', '*****@*****.**', 60)
    candidate_1 = Candidate('John Snow', '*****@*****.**', 'Jaba-Java', 'trainee')
    candidate_2 = Candidate('Hodor', '*****@*****.**', 'Hodor', 'hodor')
    candidate_3 = Candidate('Groot', 'iamgroot@groot', '01001101 programmer', 'guardian of senior')
    vacancy_1 = Vacancy('Python')
    vacancy_2 = Vacancy('01001101 programmer')
示例#8
0
def main():
    recruiter1 = Recruiter('Natali', nata @ gmail.com, 20)
    programmer1 = Programmer('Alex', alex @ mail.ru, 50)
    programmer2 = Programmer('Roman', roman @ gmail.com, 60)
    candidate1 = Candidate('Vasil', vasyok @ gmail.com, 'Python')
    candidate2 = Candidate('Grisha', grigor @ rambler.ru, 'Python')
    candidate3 = Candidate('Katya', kate @ gmail.com, 'FrontEnd')
    vacancy1 = Vacancy('Python')
    vacancy2 = Vacancy('FrontEnd')
示例#9
0
def main():
    recruiter1 = Recruiter()
    programmer1 = Programmer()
    programmer2 = Programmer()
    candidate1 = Candidate()
    candidate2 = Candidate()
    candidate3 = Candidate()
    vacancy1 = Vacancy()
    vacancy2 = Vacancy()
示例#10
0
def main():

    recr_1 = Recruiter('Vika', '*****@*****.**', 24)
    emp_2 = Programmer('Sophia', '*****@*****.**', 30,
                       ['Python', 'SQL', 'CSS', 'PostgreSQL'])
    emp_3 = Programmer('Vlad', '*****@*****.**', 500,
                       ['Python', 'GitHub', 'Java'])
    cand_1 = Candidate('Valentin Zal', '@gmail.com', ['SQL', 'Java'],
                       'English', 'Magister')
    cand_2 = Candidate('Valentin Zal', '@gmail.com', ['SQL', 'Java'],
                       'English', 'Magister')
    cand_3 = Candidate('Valentin Zal', '@gmail.com', ['SQL', 'Java'],
                       'English', 'Magister')
    vak_1 = Vacancy('Programmer', ['C++', 'C#'], 'Midle')
    vak_2 = Vacancy('Desiner', ['Figma', 'C#'], 'Midle')
示例#11
0
async def menu(query: callback_query, state: FSMContext):
    if state:
        await state.finish()
    keyboard = InlineKeyboardMarkup()
    keyboard.add(
        InlineKeyboardButton(buttons.create_vacancy,
                             callback_data='create_vacancy'),
        # InlineKeyboardButton(buttons.find_vacancies, callback_data='find_vacancies')
    )
    vacancies = Vacancy.select().where(Vacancy.creator == User.get(
        User.chat_id == query.message.chat.id))
    if vacancies:
        keyboard.add(
            InlineKeyboardButton(buttons.placed_vacancies,
                                 callback_data='placed_vacancies'))

    candidate = Candidate.select().where(Candidate.user == User.get(
        User.chat_id == query.message.chat.id))
    for i in candidate:
        if i.status == 'Отправлено тестовое задание':
            keyboard.add(
                InlineKeyboardButton(
                    f'Тестовое - {i.vacancy.name}',
                    callback_data=f'send_test_task_solution_{i.vacancy.id}'))
    await query.message.answer(messages.menu, reply_markup=keyboard)
示例#12
0
async def name_find_vacancies(message: types.Message, state: FSMContext):
    await state.update_data(name=message.text)
    async with state.proxy() as find_vacancies_:
        name = find_vacancies_['name']
        rations = {}
        vacanncies = Vacancy.select()
        for i in vacanncies:
            rations[i.id] = fuzz.token_sort_ratio(name, i.name)
    await FindVacancy.next()
    rations = OrderedDict(
        sorted(rations.items(), key=itemgetter(1), reverse=True))
    keyboard = InlineKeyboardMarkup()
    for i in rations:
        vacancy = Vacancy.get(Vacancy.id == i)
        keyboard.add(
            InlineKeyboardButton(f'{vacancy.name} - {vacancy.income} руб.',
                                 callback_data=f'vacancy_{i}'))
    await message.answer(messages.what_we_found, reply_markup=keyboard)
    def setUp(self):
        # Every test needs a client.
        self.client = Client()

        self.toothjob = Vacancy(
            title = "Pulling teeth",
            slug = "pulling-teeth",
            date = datetime.now() + timedelta(days=30),
            )
示例#14
0
async def add_task(query: callback_query, state: FSMContext):
    vacancy_id = int(query.data.split('_')[2])
    vacancy = Vacancy.get(Vacancy.id == vacancy_id)
    keyboard = InlineKeyboardMarkup()
    keyboard.add(
        InlineKeyboardButton(buttons.back, callback_data='vacancy_myback'))
    await AddTaskState.file.set()
    await state.update_data(vacancy_id=vacancy_id)
    await query.message.answer(messages.send_me_task, reply_markup=keyboard)
示例#15
0
async def start_handler(message: types.Message, state: FSMContext):
    if state:
        await state.finish()
    text = message.text.split(' ')
    if len(text) > 1:
        payload = decode_payload(text[1])
        vacancy_id = int(payload)
        if not message.from_user.username:
            await CheckUsername.payload.set()
            await state.update_data(payload=vacancy_id)
            await state.update_data(user_id=message.from_user.id)
            await set_username(message.chat.id)
            return
        user = User.get_or_none(User.chat_id == message.chat.id)
        if not user:
            user = User(username=message.from_user.username,
                        first_name=message.from_user.first_name,
                        second_name=message.from_user.last_name,
                        chat_id=message.chat.id)
            user.save()
        # await FindVacancy.name.set()
        await show_vacancy_pure(message.chat.id, vacancy_id)
    else:
        user = User.get_or_none(User.chat_id == message.chat.id)
        if not user:
            user = User(username=message.from_user.username,
                        first_name=message.from_user.first_name,
                        second_name=message.from_user.last_name,
                        chat_id=message.chat.id)
            user.save()
            await message.answer(messages.start_message)

        keyboard = InlineKeyboardMarkup()
        keyboard.add(
            InlineKeyboardButton(buttons.create_vacancy,
                                 callback_data='create_vacancy'),
            # InlineKeyboardButton(buttons.find_vacancies, callback_data='find_vacancies')
        )
        vacancies = Vacancy.select().where(Vacancy.creator == User.get(
            User.chat_id == message.chat.id))
        if vacancies:
            keyboard.add(
                InlineKeyboardButton(buttons.placed_vacancies,
                                     callback_data='placed_vacancies'))

        candidate = Candidate.select().where(Candidate.user == User.get(
            User.chat_id == message.chat.id))
        for i in candidate:
            if i.status == 'Отправлено тестовое задание':
                keyboard.add(
                    InlineKeyboardButton(
                        buttons.test_task.format(i.vacancy.name),
                        callback_data=f'send_test_task_solution_{i.vacancy.id}'
                    ))

        await message.answer(messages.menu, reply_markup=keyboard)
示例#16
0
async def correct_vacancy(query: callback_query, state: FSMContext):
    async with state.proxy() as vacancy:
        user = User.get(User.chat_id == query.message.chat.id)
        vacancy_record = Vacancy(creator=user,
                                 name=vacancy['name'],
                                 specialization=vacancy['specialization'],
                                 description=vacancy['description'],
                                 key_skills=vacancy['key_skills'],
                                 income=vacancy['income'],
                                 test_task=None)
        vacancy_record.save()

    await state.finish()
    keyboard = InlineKeyboardMarkup()
    keyboard.add(
        InlineKeyboardButton(buttons.menu, callback_data='menu'),
        InlineKeyboardButton(buttons.create_vacancy,
                             callback_data='create_vacancy'))
    await query.message.answer(messages.vacancy_created, reply_markup=keyboard)
示例#17
0
async def placed_vacancies(query: callback_query):
    keyboard = InlineKeyboardMarkup()
    vacancies = Vacancy.select().where(Vacancy.creator == User.get(
        User.chat_id == query.message.chat.id))
    for i in vacancies:
        keyboard.add(
            InlineKeyboardButton(f'{i.name} - {i.income} руб.',
                                 callback_data=f'vacancy_my_{i.id}'))
    await query.message.answer(messages.placed_vacancies,
                               reply_markup=keyboard)
示例#18
0
def main():
    vasilyev = Programmer(
        ['js', 'python', 'make good coffee'],
        'Vasya',
        'Vasilyev',
        '*****@*****.**',
        '+322223322',
        32,
    )

    gunko = Programmer(['js', 'python', 'kubernetes', 'docker'], 'petr',
                       'gunko', '*****@*****.**', '+322227772', 30)

    tatarinova = Recruiter('Lena', 'Tatarinova', '*****@*****.**', '+372223322',
                           32)
    gagarin = Candidate('Yuriy Gagarin', '*****@*****.**',
                        ['spaceman', 'pilot'], 'pilot', 100)
    peterson = Candidate('Jim Peterson', 'jim_peterson.gmail.com',
                         ['python', 'js'], 'python', 79)
    vorghol = Candidate('Anastasia Vorghol', 'vorghol_a1952.gmail.com',
                        ['python', 'js'], 'js', 68)
    js_junior = Vacancy('JS Junior', 'js', 45)
    python_middle = Vacancy('Python Middle', 'python', 60)

    print(vasilyev, gunko, tatarinova, sep='\n')
    print(f'{vasilyev.name} salary: {vasilyev.check_salary()}')
    print(vasilyev.surname, 'said:', vasilyev.work())
    print(vasilyev > tatarinova)
    print(vasilyev >= tatarinova)
    print(vasilyev.tech_stack)
    print(gunko)
    print(vasilyev < gunko)
    print(vasilyev + gunko)
    print(js_junior)
    print(peterson)
    print(vorghol)
    print(gagarin)
    print(python_middle)
    print(vasilyev.about_person)
    data = Candidate.make_candidates_from_csv()
    [print(i) for i in data]
示例#19
0
文件: app.py 项目: Allinka1/OOP
def main():
    employee_1 = Programmer('Alinka', '*****@*****.**', 100,
                            ['Python', 'HTML', 'CSS', 'PostgreSQL'])
    employee_2 = Programmer('Nikita', '*****@*****.**', 500,
                            ['Python', 'GitHub'])
    recruiter_1 = Recruiter('Dasha', '*****@*****.**', 100)
    candidate_1 = Candidate('Maria Klukina', '*****@*****.**',
                            ['Python', 'Java Script'], 'Python', 'middle')
    candidate_2 = Candidate('Dima Mironin', '*****@*****.**',
                            ['Ruby', 'C#', 'Java'], 'Ruby', 'senior')
    candidate_3 = Candidate('Vladislav Limov', '*****@*****.**',
                            ['HTML', 'CSS', 'C++'], 'C++', 'junior')
    vacancy_1 = Vacancy('Python Developer', 'Python', 'middle')
    vacancy_2 = Vacancy('Ruby Developer', 'Ruby', 'senior')
    # candidate_1.work()
    # print(recruiter_1.full_info)
    # print(employee_1.full_info)
    # print(Candidate.from_csv('candidates.csv'))
    print(
        Candidate.from_csv(
            'https://bitbucket.org/ivnukov/lesson2/raw/master/candidates.csv'))
示例#20
0
async def add_task_file(message: types.Message, state: FSMContext):
    await state.update_data(file=message.document.file_id)
    async with state.proxy() as s:
        vacancy = Vacancy.get(Vacancy.id == s['vacancy_id'])
        file_path = settings.tasks_path_base + str(
            s['vacancy_id']) + '_' + message.document.file_name
        await bot.download_file_by_id(s['file'], file_path)
        vacancy.test_task = file_path
        vacancy.save()
    await state.finish()
    keyboard = InlineKeyboardMarkup()
    keyboard.add(InlineKeyboardButton(buttons.menu, callback_data='menu'))
    await message.answer(messages.saved_task, reply_markup=keyboard)
示例#21
0
async def send_test_task_solution(query: callback_query, state: FSMContext):
    vacancy_id = int(query.data.split('_')[4])
    keyboard = InlineKeyboardMarkup()
    keyboard.add(
        InlineKeyboardButton(buttons.back,
                             callback_data='send_test_task_solutionback'))
    await SendTaskSolution.file.set()
    await state.update_data(vacancy_id=vacancy_id)
    candidate = Candidate.select().where(Candidate.user == User.get(User.chat_id == query.message.chat.id)) \
        .where(Candidate.vacancy == Vacancy.get(Vacancy.id == vacancy_id)).where(
        Candidate.status == 'Отправлено тестовое задание').get()
    await state.update_data(candidate_id=candidate.id)
    await query.message.answer(messages.send_me_solution,
                               reply_markup=keyboard)
    def setUp(self):
        # Every test needs a client.
        self.client = Client()

        # create a vacancy item
        self.toothjob = Vacancy(
            title = "Pulling teeth",
            slug = "pulling-teeth",
            date = datetime.now() + timedelta(days=30),
            )

        self.adminuser = User.objects.create_user('arkestra', '*****@*****.**', 'arkestra')
        self.adminuser.is_staff=True
        self.adminuser.save()
class VacanciesItemsViewsTests(TestCase):
    def setUp(self):
        # Every test needs a client.
        self.client = Client()

        # create a vacancy item
        self.toothjob = Vacancy(
            title = "Pulling teeth",
            slug = "pulling-teeth",
            date = datetime.now() + timedelta(days=30),
            )

        self.adminuser = User.objects.create_user('arkestra', '*****@*****.**', 'arkestra')
        self.adminuser.is_staff=True
        self.adminuser.save()

    # vacancy tests
    def test_unpublished_vacancy_404(self):
        self.toothjob.save()

        # Issue a GET request.
        response = self.client.get('/vacancy/pulling-teeth/')

        # Check that the response is 404 because it's not published
        self.assertEqual(response.status_code, 404)

    def test_unpublished_vacancy_200_for_admin(self):
        self.toothjob.save()

        # log in a staff user
        self.client.login(username='******', password='******')
        response = self.client.get('/vacancy/pulling-teeth/')
        self.assertEqual(response.status_code, 200)

    def test_published_vacancy_200_for_everyone(self):
        self.toothjob.published = True
        self.toothjob.save()

        # Check that the response is 200 OK.
        response = self.client.get('/vacancy/pulling-teeth/')
        self.assertEqual(response.status_code, 200)

    def test_published_vacancy_context(self):
        self.toothjob.published = True
        self.toothjob.save()
        response = self.client.get('/vacancy/pulling-teeth/')
        self.assertEqual(response.context['vacancy'], self.toothjob)
示例#24
0
async def show_vacancy_pure(chat_id, vacancy_id):
    vacancy = Vacancy.get(Vacancy.id == vacancy_id)
    keyboard = InlineKeyboardMarkup()
    await FindVacancy.id.set()

    keyboard.add(
        InlineKeyboardButton(buttons.additional_information,
                             callback_data='additional_information'))
    keyboard.add(
        InlineKeyboardButton(buttons.send_resume,
                             callback_data=f'send_resume_{vacancy_id}'))
    await bot.send_message(chat_id,
                           messages.vacancy_template.format(
                               vacancy.name, vacancy.specialization,
                               vacancy.description, vacancy.key_skills,
                               vacancy.income),
                           reply_markup=keyboard)
示例#25
0
async def show_vacancy(query: callback_query, state: FSMContext):
    vacancy_id = int(query.data.split('_')[1])
    vacancy = Vacancy.get(Vacancy.id == vacancy_id)
    await state.update_data(id=vacancy_id)
    keyboard = InlineKeyboardMarkup()
    keyboard.add(
        InlineKeyboardButton(buttons.additional_information,
                             callback_data='additional_information'))
    keyboard.add(
        InlineKeyboardButton(buttons.back,
                             callback_data='back_to_find_vacancies'),
        InlineKeyboardButton(buttons.send_resume,
                             callback_data=f'send_resume_{vacancy_id}'))
    await query.message.answer(messages.vacancy_template.format(
        vacancy.name, vacancy.specialization, vacancy.description,
        vacancy.key_skills, vacancy.income),
                               reply_markup=keyboard)
class FilterListTests(TestCase):
    def setUp(self):
        self.item1 = Vacancy(
            title="closes today, less important",
            in_lists=True,
            published=True,
            date=datetime.now()
            )
        self.item1.save()

        self.item2 = Vacancy(
            title="closed 20 days ago, important",
            summary="a job for today",
            in_lists=True,
            published=True,
            date=datetime.now()-timedelta(days=20),
            importance=3,
            slug="item2"
            )
        self.item2.save()

        self.item3 = Vacancy(
            title="closes in the future",
            in_lists=True,
            published=True,
            date=datetime.now()+timedelta(days=20),
            importance=3,
            slug="item3"
            )
        self.item3.save()

        self.itemlist = FilterList()
        self.itemlist.model = Vacancy
        self.itemlist.request = HttpRequest()

    def test_filter_on_search_terms_no_terms(self):
        query = QueryDict("")
        self.itemlist.request.GET = query
        self.itemlist.build()
        self.assertEqual(
            list(self.itemlist.items),
            [self.item1, self.item3]
            )

    def test_filter_on_search_terms_1_match(self):
        query = QueryDict("text=today")
        self.itemlist.request.GET = query
        self.itemlist.build()
        self.assertEqual(
            list(self.itemlist.items),
            [self.item1]
            )
示例#27
0
def save_vacancy():
    try:
        comp_id = request.form['comp_id']
        cand_id = request.form['cand_id']
        post_date = request.form['post_date']
        expiry_date = request.form['expiry_date']
        sal_min = request.form['sal_min']
        sal_max = request.form['sal_max']
        fulltime = request.form['fulltime']

        # saving vacancy in db
        vacancy = Vacancy(comp_id, cand_id, post_date, expiry_date, sal_min,
                          sal_max, fulltime)
        db.session.add(vacancy)
        db.session.commit()
    except Exception as exp:
        print "save_vacancy() :: Got Exception: %s" % exp
        print(traceback.format_exc())
    return "Vacancy saved"
示例#28
0
def get_vacancies(min_count=6):
    url = api + "vacancies"
    response = requests.get(url)
    json = response.json()

    if (min_count > 20):
        min_count = 20

    vacancies = []

    for i in range(min_count):
        item = json['items'][i]
        vacancy = Vacancy(item['id'], item['name'], item['area'],
                          item['salary'], item['address'],
                          item['published_at'], item['created_at'],
                          item['url'], item['snippet'])
        vacancies.append(vacancy)

    return vacancies
示例#29
0
async def vacancy_my(query: callback_query):
    vacancy_id = int(query.data.split('_')[2])
    keyboard = InlineKeyboardMarkup()
    vacancy = Vacancy.get(Vacancy.id == vacancy_id)
    keyboard.add(
        InlineKeyboardButton(buttons.delete_vacancy,
                             callback_data=f'delete_vacancy_{vacancy_id}'))
    if not vacancy.test_task:
        keyboard.add(
            InlineKeyboardButton(buttons.back, callback_data='vacancy_myback'),
            InlineKeyboardButton(buttons.add_tasks,
                                 callback_data=f'add_task_{vacancy_id}'))
    else:
        keyboard.add(
            InlineKeyboardButton(buttons.back, callback_data='vacancy_myback'))
    link = await get_start_link(str(vacancy_id), encode=True)
    await query.message.answer(messages.vacancy_template_with_deeplink.format(
        vacancy.name, vacancy.specialization, vacancy.description,
        vacancy.key_skills, vacancy.income, link),
                               reply_markup=keyboard)
示例#30
0
from models import Programmer, Recruiter
from models import Candidate, Vacancy

if __name__ == '__main__':

    technologies = ['python', 'js', 'html', 'css']
    recruiter_anna = Recruiter('Anna', "*****@*****.**", 50)
    programmer_oleg = Programmer('Oleg', "*****@*****.**", 100)
    programmer_vasya = Programmer('Vasya', "*****@*****.**", 75)
    candidate_grisha = Candidate('Grisha Vetrov', '*****@*****.**',
                                 technologies, 'Python', 'Middle')
    candidate_petya = Candidate('Petr Vetrov', '*****@*****.**', technologies,
                                'Python', 'Junior')
    candidate_kolya = Candidate('Kolya Ivanov', '*****@*****.**',
                                technologies, 'Python', 'Senior')
    vacancy_python_middle = Vacancy('Python Middle on Project 1', 'Python',
                                    'Middle')
    vacancy_python_senior = Vacancy('Python Senior on Project 2', 'Python',
                                    'Senior')

    print(programmer_oleg.work())
    print(programmer_vasya.check_salary(15))
    print(programmer_oleg.__str__())
    print(recruiter_anna.work())
    print(recruiter_anna.check_salary(15))
    print(recruiter_anna.__str__())

    print(candidate_grisha.__str__())
    print(candidate_petya.__str__())
    print(candidate_kolya.__str__())
    print(vacancy_python_middle.__str__())
    print(vacancy_python_senior.__str__())
示例#31
0
文件: app.py 项目: zaharapple/OOP
def main():
    try:
        r = Recruiter(name="Sasha", zp_day=150, days=21, email='sasha@com')
        p = Programmer(name="Slava", zp_day=220, days=23, email='sl@com',
                       tech_stack={'have a car ', 'Python', 'JS', 'Git', 'HTML'})
        p2 = Programmer(name="Kostya", zp_day=200, days=24, email='kos@com',
                        tech_stack={'know of English ', 'Python', 'Django', 'flaks', 'react'})
        c = Candidate("Petya", "pet@com", "Razrabotka", "JS", "trenie")
        c2 = Candidate("Katya", "KET@com", "Recruter", "English", "С1")
        c3 = Candidate("Kiril", "Kir@com", "Razrabotkbotka", "Python", "junior")
        v = Vacancy("Programmer", "Python,JS,HTML", "junior")
        v2 = Vacancy("Recruiter", "комуникабельность , знание английского языка", "стаж 1год")

        # print(v)
        # print(v2)
        #
        # print('---------------------------')
        #
        # print(c)
        # # print(c.work())
        # print(c2)
        # print(c3)
        #
        # print('---------------------------')
        #
        # print(r)
        # print(r.work())
        # print(r.cheak_salary())
        #
        # print('---------------------------')
        #
        # print(p)
        # print(p.work())
        # print(p.cheak_salary())
        # print(p.tech_stack)
        #
        # print('---------------------------')
        # print(r == p)  # comparison by salary
        # print('---------------------------')
        # print(p.cheak_salary())
        #
        # print(p2)
        # print(p2.work())
        # print(p2.cheak_salary())
        # print(p2.tech_stack)
        #
        # print('---------------------------')
        # print(p > p2)
        # print()
        #
        # alfaprogr = p + p2
        # print(alfaprogr)
        # print(alfaprogr.work())
        # print(alfaprogr.cheak_salary())
        # print(alfaprogr.tech_stack)
        print(p.full_info)
        Candidate.create_candidat(' candidates.csv')


    except Exception as e:

        with open('logs.txt', 'a+') as log:
            mytime = (datetime.now().ctime())
            log.write(mytime + '\n')
            log.write(traceback.format_exc() + '------------------' + '\n')
示例#32
0
文件: app.py 项目: shpilievoi29/OOP
from models import Vacancy

if __name__ == '__main__':
    igor = Programmer('Igor', 1000, '*****@*****.**', 'programmer',
                      ['JS', 'Python', 'Delphi'])

    sasha = Programmer('Sasha', 130, '*****@*****.**', 'programmer',
                       ['Python'])

    curt = Recruiter('Cobain', 180, '*****@*****.**', 'recruiter')

    john = Candidate('John Fitzgerald Kennedy', '*****@*****.**',
                     ["Python", 'JS'], ['Pylon', 'JS'],
                     ['Python -middle', 'JS-junior'])

    java = Vacancy('Java', ['Java game developer'],
                   ['Java - middle', 'Python - senior'])

    full_stack = Vacancy('Full-Stack', ['PHP', 'MySQL', 'JS'],
                         ['PHP - senior', 'MySql - senior', 'JS -middle'])
    oleg = Employee('Oleg', 120, '*****@*****.**', 'programmer')

    # print(Programmer.comparison_stack(igor, sasha))
    #print(Employee.check_salary(sasha, Employee.day_count))
    # print(sasha.__dict__)
    # print(igor.__dict__)
    # print(Programmer.comparison_stack(sasha, igor))
    # print(Employee.check_salary(igor, Employee.day_count))
try:
    Candidate.work(john)

except Exception as err:
class ListTests(TestCase):
    def setUp(self):
        self.item1 = Vacancy(
            title="closes today, less important",
            in_lists=True,
            published=True,
            date=datetime.now()
            )
        self.item1.save()

        self.item2 = Vacancy(
            title="closed 20 days ago, important",
            summary="a job for today",
            in_lists=True,
            published=True,
            date=datetime.now()-timedelta(days=20),
            importance=3,
            slug="item2"
            )
        self.item2.save()

        self.item3 = Vacancy(
            title="closes in the future",
            in_lists=True,
            published=True,
            date=datetime.now()+timedelta(days=20),
            importance=3,
            slug="item3"
            )
        self.item3.save()

        self.itemlist = List()
        self.itemlist.model = Vacancy
        self.itemlist.model_string = "vacancies"
        self.itemlist.items = Vacancy.objects.all()

    def test_all_items_order(self):
        self.assertEqual(
            list(self.itemlist.items),
            [self.item2, self.item1, self.item3]
            )

    def test_reorder_by_importance_date_only(self):
        # check the re-ordered items are not changed
        self.itemlist.re_order_by_importance()
        self.assertEqual(
            list(self.itemlist.items),
            [self.item2, self.item1, self.item3]
            )

    def test_reorder_by_importance_date_makes_no_difference(self):
        # check that items are re-ordered by importance
        self.itemlist.order_by = "importance/date"
        self.itemlist.re_order_by_importance()

        self.assertEqual(
            list(self.itemlist.items),
            [self.item2, self.item1, self.item3]
            )

    def test_truncate_items(self):
        # check that items are re-ordered by importance
        self.itemlist.limit_to = 1
        self.itemlist.truncate_items()

        self.assertEqual(
            list(self.itemlist.items),
            [self.item2]
            )

    def test_set_items_for_person(self):
        p = Person()
        p.save()
        self.item1.please_contact.add(p)

        self.itemlist.person = p
        self.itemlist.set_items_for_person()

        self.assertEqual(
            list(self.itemlist.items),
            [self.item1]
        )

    def test_build(self):
        self.itemlist.build()
        self.assertEqual(list(self.itemlist.items), [self.item1, self.item3])

    def test_other_items(self):
        school = Entity(name="School of Medicine")
        school.save()

        self.itemlist.entity = school
        self.itemlist.other_item_kinds = ["archived"]
        self.item1.hosted_by = school
        self.item2.hosted_by = school
        self.item3.hosted_by = school
        self.item1.save()
        self.item2.save()
        self.item3.save()

        self.itemlist.build()

        self.assertEqual(list(self.itemlist.items), [self.item1, self.item3])
        self.assertEqual(list(self.itemlist.archived), [self.item2])
        self.assertEqual(
            list(self.itemlist.other_items()),
            [{
                'count': 1,
                'link': '/archived-vacancies/',
                'title': 'Archived vacancies'
                }]
            )