colorstackatuw / ColorStack-Discord-Bot

Discord bot created by ColorStack at UW-Madison to track and post internship opportunities within your Discord
https://colorstack.cs.wisc.edu
MIT License
7 stars 3 forks source link

Failing on certain cities due to poor formatting #9

Closed DavidSalazar123 closed 9 months ago

DavidSalazar123 commented 9 months ago

Describe the bug On Feb 03, the program wasn't able to post any of jobs due the locations being described as SF and NYC.

To Reproduce Steps to reproduce the behavior: Prove a step by step guide on how to reproduce this problem

  1. Within InternshipUtilities.py, change the python date = "Feb 03 for methods getSummerInternships() and getCoopInternships()
  2. Remove all the discord comments to not spam the chat in DicordBot.py

Expected behavior What we expect to happen is the bot is able to post the job with the location. This can only be done if the following logic within each method is fixed.

                  # If there are multiple locations, we need to populate the string correctly
                  if len(list_locations) > 1:
                      location = " | ".join(list_locations)
                  else:
                      is_remote = bool(
                          re.search(r"(?i)\bremote\b", non_empty_elements[2])
                      )
                      location = "Remote" if is_remote else non_empty_elements[2]

                      if location != "Remote":
                          # The error is right here! The regex is not working as expected
                          # We need to check for State, acryonm of major cities, and the full name of major cities, and (US, USA, United States)
                          match = re.search(r",\s*(.+)", location)
                          us_state = match.group(1) if match else match

                          if not us_state or not self.binarySearchUS(us_state):
                              continue

Desktop (please complete the following information):

DavidSalazar123 commented 9 months ago

Issue was resolved within commit: f613db8de917f283b45f01cef72ede3d489164eb