Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
olikami committed May 12, 2022
1 parent 2367cea commit 2f8577f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

api_key = os.getenv("API_KEY")
group = os.getenv("GROUP")
attribute_to_check = os.getenv("ATTRIBUTE_TO_CHECK")
username = os.getenv("USERNAME")
password = os.getenv("PASSWORD")

BASE_URL = "https://db.scout.ch"
ATTRIBUTE_TO_CHECK = "ahv_number"

s = requests.Session()

Expand Down Expand Up @@ -87,14 +87,14 @@ def name_formatter(nickname, firstname, lastname):
):
people.append(get_people_details(person_id, group_id))

people.sort(key=lambda p: p["last_name"].replace("von ","") + p["first_name"])
people.sort(key=lambda p: p["last_name"].replace("von ", "") + p["first_name"])

ahv_regex = re.compile("\d{3}.\d{4}.\d{4}.\d{2}")

people_without_ahv = [
person
for person in people
if not (person[attribute_to_check] and ahv_regex.match(person[attribute_to_check]))
if not (person[ATTRIBUTE_TO_CHECK] and ahv_regex.match(person[ATTRIBUTE_TO_CHECK]))
]

print(f"Mit AHV-Nr: {len(people) - len(people_without_ahv)}")
Expand Down

0 comments on commit 2f8577f

Please sign in to comment.