Esempio n. 1
0
    def send_categories(self, user, text):
        if user.profile == 1:
            JobManager(user_id=user.id).clean()
            dialog = DialogJobManager(user_id=user.id)
            dialog.clean()
            dialog.create()
        elif user.profile == 2:
            ResumeManager(user_id=user.id).clean()
            dialog = DialogResumeManager(user_id=user.id)
            dialog.clean()
            dialog.create()
        else:
            print(__name__, 'send cat')

        text = self.text.send_categories()

        if self.check_search_city(user=user):
            reply_markup = self.markup.send_categories(search=True)
        else:
            reply_markup = self.markup.send_categories()

        try:
            self.edit_message_text(text=text, reply_markup=reply_markup)
        except ApiException:
            self.send_message(text=text, reply_markup=reply_markup)
Esempio n. 2
0
 def view_resume(self, user, text):
     resume_id = text.split(':')[-1]
     resume = ResumeManager(user_id=user.id).get_resume_for_id(
         resume_id=resume_id)
     text = self.text.view_resume(resume=resume)
     markup = self.markup.view_resume(resume=resume)
     return self.edit_message_text(text=text, reply_markup=markup)
Esempio n. 3
0
 def _clean(cls, user):
     DialogSearchManager(user_id=user.id).clean()
     SearchManager(user_id=user.id).clean()
     JobManager(user_id=user.id).clean()
     DialogJobManager(user_id=user.id).clean()
     DialogResumeManager(user_id=user.id).clean()
     ResumeManager(user_id=user.id).clean()
Esempio n. 4
0
    def publish(self, user, text):
        if user.profile == 1:
            JobManager(user_id=user.id).publish()

            if not user.free_send:
                UserManager(user_id=user.id).free_send()
                _text = self.text.free_send()
                self.send_message(text=_text)

                job_id = text.split('free:')[-1]
                job = JobManager(user_id=user.id).job(job_id)

                resumes = ResumeManager(user_id=self.user_id).search_resume(
                    city=job.city,
                    category=job.category,
                    posistion=job.position)

                if not resumes:
                    text = self.text.not_jobs()
                    return self.send_message(text=text)

                candidates = [
                    i.user.user_id for i in resumes
                    if i.user.user_id != self.user_id
                ]

                self.send_to(candidates[:10], job)

                text = self.text.top_up_account(balance=user.credit)
                markup = self.markup.my_score()
                return self.send_message(text=text, reply_markup=markup)
            else:
                price = 0.02
                if float(user.credit) < price:
                    text = self.text.top_up_account(balance=user.credit)
                    markup = self.markup.my_score()
                    return self.send_message(text=text, reply_markup=markup)
                else:
                    text = self.text.why_send()
                    return self.send_message(text=text)
        elif user.profile == 2:
            text = self.text.publish(user)
            ResumeManager(user_id=user.id).publish()
            return self.send_message(text=text)
Esempio n. 5
0
    def work_moderation(self, text, user):
        ResumeManager(user_id=user.id).update_description(description=text)
        DialogResumeManager(user_id=user.id).clean()
        text = self.text.work_moderation()
        self.send_message(text=text)

        if hasattr(user, 'username') and user.username:
            name = user.username
        else:
            name = user.id

        return self.send_message(user_id=652287516,
                                 text=f'Появилося нове резюме\n{name}')
Esempio n. 6
0
    def send_sub_category(self, category, user):
        if user.profile == 1:
            JobManager(user_id=user.id).create(category=category)
            DialogJobManager(user_id=user.id).update_category()
        elif user.profile == 2:
            ResumeManager(user_id=user.id).create(category=category)
            DialogResumeManager(user_id=user.id).update_category()
        else:
            print(__name__, 'send sub cat')

        text = self.text.send_sub_category()

        if self.check_search_category(user=user):
            reply_markup = self.markup.send_sub_category(category, search=True)
        else:
            reply_markup = self.markup.send_sub_category(category)

        return self.edit_message_text(text=text, reply_markup=reply_markup)
Esempio n. 7
0
    def my_resume(self, user, text):
        resumes = ResumeManager(user_id=user.id).get_resume()
        if resumes:
            text = self.text.my_resume()
            markup = self.markup.my_resume(resumes=resumes)

            if text and markup.keyboard:
                try:
                    self.edit_message_text(text=text, reply_markup=markup)
                except ApiException as error:
                    print(str(error))
                    self.send_message(text=text, reply_markup=markup)
            else:
                text = self.text.my_resume_on_moderation()
                self.send_message(text=text)
        else:
            text = self.text.my_resume_on_moderation()
            self.send_message(text=text)
Esempio n. 8
0
    def found_candidates(self, user, text):
        job_id = text.split('send:')[-1]
        job = JobManager(user_id=user.id).job(job_id)

        resumes = ResumeManager(user_id=self.user_id).search_resume(
            city=job.city, category=job.category, posistion=job.position)

        if not resumes:
            text = self.text.not_jobs()
            return self.send_message(text=text)

        candidates = [i.user.user_id for i in resumes]
        SendManager(user_id=user.id).create(job_id, candidates)

        balance = UserManager(user_id=self.user_id).get_score()
        text = self.text.found_candidates(len(resumes), balance)

        return self.send_message(text=text)
Esempio n. 9
0
 def age(self, text, user):
     ResumeManager(user_id=user.id).update_name(name=text)
     DialogResumeManager(user_id=user.id).age()
     text = self.text.age()
     return self.send_message(text=text)
Esempio n. 10
0
 def name(self, position, user):
     ResumeManager(user_id=user.id).update_position(position=position)
     DialogResumeManager(user_id=user.id).name()
     text = self.text.name()
     return self.send_message(text=text)
Esempio n. 11
0
 def work_experience(self, text, user):
     ResumeManager(user_id=user.id).update_lang(lang=text)
     DialogResumeManager(user_id=user.id).experience()
     text = self.text.work_experience()
     markup = self.markup.experience()
     return self.send_message(text=text, reply_markup=markup)
Esempio n. 12
0
 def work_city(self, text, user):
     ResumeManager(user_id=user.id).update_age(age=text)
     DialogResumeManager(user_id=user.id).city()
     text = self.text.work_city()
     markup = self.markup.city()
     return self.send_message(text=text, reply_markup=markup)
Esempio n. 13
0
 def update_resume(self, user, text):
     resume_id = text.split(':')[-1]
     ResumeManager(user_id=user.id).update_resume(resume_id=resume_id)
     return self.view_resume(user=user, text=text)
Esempio n. 14
0
 def delete_resume(self, user, text):
     resume_id = text.split(':')[-1]
     ResumeManager(user_id=user.id).delete_resume(resume_id=resume_id)
     return self.my_resume(user=user)
Esempio n. 15
0
 def lang(self, text, user):
     ResumeManager(user_id=user.id).update_city(city=text)
     DialogResumeManager(user_id=user.id).lang()
     text = self.text.lang()
     return self.send_message(text=text)
Esempio n. 16
0
 def education(self, text, user):
     ResumeManager(user_id=user.id).update_experience(experience=text)
     DialogResumeManager(user_id=user.id).education()
     text = self.text.education()
     return self.send_message(text=text)
Esempio n. 17
0
 def work_description(self, text, user):
     ResumeManager(user_id=user.id).update_education(education=text)
     DialogResumeManager(user_id=user.id).description()
     text = self.text.work_description()
     return self.send_message(text=text)