Skip to content

Commit

Permalink
Merge pull request #432 from 999AICoder/main
Browse files Browse the repository at this point in the history
fix: Update README.md to use apply_once_at_company style
  • Loading branch information
feder-cr authored Sep 25, 2024
2 parents 4cad042 + da7cec8 commit 3cec819
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ This file defines your job search parameters and bot behavior. Each section cont
- Italy
- London
```
- `applyOnceAtCompany: [True/False]`
- Set if you will apply in more than one opportunity per company
- `apply_once_at_company: [True/False]`
- Set to `True` to apply only once per company, `False` to allow multiple applications per company

- `distance: [number]`
- Set the radius for your job search in miles
Expand Down
52 changes: 25 additions & 27 deletions src/aihawk_easy_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,40 +672,38 @@ def _find_and_handle_textbox_question(self, section: WebElement) -> bool:
is_numeric = self._is_numeric_field(text_field)
logger.debug(f"Is the field numeric? {'Yes' if is_numeric else 'No'}")

existing_answer = None
question_type = 'numeric' if is_numeric else 'textbox'

for item in self.all_data:

logger.debug(
f"Comparing sanitized stored question: '{self._sanitize_text(item['question'])}' and type: '{item.get('type')}' with current question: '{self._sanitize_text(question_text)}' and type: '{question_type}'")

if self._sanitize_text(item['question']) == self._sanitize_text(question_text) and item.get(
'type') == question_type:
existing_answer = item
logger.debug(f"Found existing answer in the data: {existing_answer['answer']}")
break

if existing_answer:
self._enter_text(text_field, existing_answer['answer'])
logger.debug("Entered existing answer into the textbox.")
# Check if it's a cover letter field (case-insensitive)
is_cover_letter = 'cover letter' in question_text.lower()

time.sleep(1)
text_field.send_keys(Keys.ARROW_DOWN)
text_field.send_keys(Keys.ENTER)
logger.debug("Selected first option from the dropdown.")
return True
# Look for existing answer if it's not a cover letter field
existing_answer = None
if not is_cover_letter:
for item in self.all_data:
if self._sanitize_text(item['question']) == self._sanitize_text(question_text) and item.get('type') == question_type:
existing_answer = item['answer']
logger.debug(f"Found existing answer: {existing_answer}")
break

if is_numeric:
answer = self.gpt_answerer.answer_question_numeric(question_text)
logger.debug(f"Generated numeric answer: {answer}")
if existing_answer and not is_cover_letter:
answer = existing_answer
logger.debug(f"Using existing answer: {answer}")
else:
answer = self.gpt_answerer.answer_question_textual_wide_range(question_text)
logger.debug(f"Generated textual answer: {answer}")
if is_numeric:
answer = self.gpt_answerer.answer_question_numeric(question_text)
logger.debug(f"Generated numeric answer: {answer}")
else:
answer = self.gpt_answerer.answer_question_textual_wide_range(question_text)
logger.debug(f"Generated textual answer: {answer}")

self._save_questions_to_json({'type': question_type, 'question': question_text, 'answer': answer})
self._enter_text(text_field, answer)
logger.debug("Entered new answer into the textbox and saved it to JSON.")
logger.debug("Entered answer into the textbox.")

# Save non-cover letter answers
if not is_cover_letter:
self._save_questions_to_json({'type': question_type, 'question': question_text, 'answer': answer})
logger.debug("Saved non-cover letter answer to JSON.")

time.sleep(1)
text_field.send_keys(Keys.ARROW_DOWN)
Expand Down

0 comments on commit 3cec819

Please sign in to comment.