Esempio n. 1
0
 def _get_vacancy_url(self):
     nick = self._connector.get_account_nick(
         get_nested(self.data, "account.id"))
     return "{url}{vacancy_id}/filter/workon/id/{applicant_id}".format(
         url=self._base_url.format(nick=nick),
         vacancy_id=str(get_nested(self.data, "event.vacancy.id")),
         applicant_id=str(get_nested(self.data, "event.applicant.id")),
     )
Esempio n. 2
0
    def _get_data_value(cls, data, attr_get_name: str,
                        attr_find: dict) -> str or None:
        for name, value in attr_find.items():
            for item in data:
                if item[name] == value:
                    return get_nested(item, attr_get_name)

        return None
Esempio n. 3
0
 def get_applicant_status(self, account_id, applicant_id):
     method = (
         self._api_url +
         f"account/{account_id}/applicants/{applicant_id}/questionary?normalize=true"
     )
     response, status_code = self._get_response(method)
     if status_code == 200:
         try:
             return get_nested(response, "already_employee.name")
         except KeyError:
             return None
     return None
Esempio n. 4
0
 def get_converted_data(self) -> list:
     if (get_nested(self.data,
                    "event.status.name") == self._allowed_status_name
             and get_nested(self.data, "event.type") == self._allowed_type):
         return [
             str(datetime.datetime.today().strftime("%d.%m.%Y %H:%M")),
             get_nested(self.data, "event.applicant.first_name"),
             get_nested(self.data, "event.applicant.last_name"),
             get_nested(self.data, "event.applicant.middle_name"),
             get_nested(self.data, "author.name"),
             self._get_vacancy_info("account_info.name"),
             self._get_account_division(),
             self._get_vacancy_url(),
             self._get_vacancy_category(),
             self._get_applicant_source(),
             self._get_status(),
         ]
     else:
         return []
Esempio n. 5
0
 def _get_vacancy_category(self):
     try:
         return get_nested(self.data, "event.vacancy.category.name")
     except KeyError:
         return None
Esempio n. 6
0
 def _get_vacancy_info(self, attr_name):
     account_id = get_nested(self.data, "account.id")
     vacancy_id = get_nested(self.data, "event.vacancy.id")
     return self._connector.get_vacancy_info(account_id, vacancy_id,
                                             attr_name)
Esempio n. 7
0
 def _get_status(self):
     account_id = get_nested(self.data, "account.id")
     applicant_id = get_nested(self.data, "event.applicant.id")
     return self._connector.get_applicant_status(account_id, applicant_id)
Esempio n. 8
0
 def _get_applicant_source(self):
     account_id = get_nested(self.data, "account.id")
     applicant_id = get_nested(self.data, "event.applicant.id")
     name = self._connector.get_applicant_source(account_id, applicant_id)
     return name
Esempio n. 9
0
 def _get_account_division(self):
     try:
         return get_nested(self.data, "event.vacancy.account_division.name")
     except TypeError:
         return get_nested(self.data, "event.vacancy.company")