29
29
30
30
TIMEZONE = tz .gettz ("America/New_York" )
31
31
NEON_ORG_ID = "decaturmakers"
32
- NEON_FIELD_NAME_FOB = "Fob10Digit"
32
+ NEON_FIELD_NAMES_FOB = [ "Fob10Digit" , "FobCSV" ]
33
33
NEON_FIELD_NAME_DM_MEMBERS = "Added to dm-members"
34
34
NEON_FIELD_NAME_CHECKR = "Invited to Checkr"
35
35
CHECKR_WORK_LOCATIONS = [
@@ -106,7 +106,7 @@ class User(NamedTuple):
106
106
account_id : str
107
107
name : str
108
108
email : Optional [str ]
109
- fob : Optional [str ]
109
+ fobs : List [str ]
110
110
zones : frozenset [str ]
111
111
is_membership_expired : bool
112
112
added_to_dm_members : bool
@@ -127,6 +127,7 @@ def can_access(neon_result: Dict[str, str], zone: str) -> bool:
127
127
return False
128
128
return all (neon_result .get (field ) for field in ZONE_REQUIREMENTS [zone ])
129
129
130
+
130
131
def check_res (res : requests .Response ):
131
132
try :
132
133
res .raise_for_status ()
@@ -135,6 +136,7 @@ def check_res(res: requests.Response):
135
136
logging .warning (res .text )
136
137
raise
137
138
139
+
138
140
class NeonOption (NamedTuple ):
139
141
"""One possible value of a "custom field" in NeonCRM"""
140
142
@@ -380,11 +382,17 @@ def get_page(page: int) -> Tuple[int, List[Dict[str, Any]]]:
380
382
)
381
383
else :
382
384
is_minor = None # unknown whether user is a minor
385
+ fobs : List [str ] = []
386
+ for fieldname in NEON_FIELD_NAMES_FOB :
387
+ fobs .extend ([
388
+ x .strip () for x in result .get (fieldname , "" ).split ("," )
389
+ if x != ""
390
+ ])
383
391
yield User (
384
392
account_id = result ["Account ID" ],
385
393
name = result ["Full Name (F)" ],
386
394
email = result ["Email 1" ] or None ,
387
- fob = result . get ( NEON_FIELD_NAME_FOB ) ,
395
+ fobs = fobs ,
388
396
zones = zones ,
389
397
is_membership_expired = expired ,
390
398
is_minor = is_minor ,
@@ -415,8 +423,9 @@ def update_users() -> None:
415
423
for user in users :
416
424
if user .email is not None :
417
425
new_users_by_email [user .email ] = user
418
- if user .fob is not None :
419
- new_users_by_fob [user .fob ] = user
426
+ if user .fobs :
427
+ for fob in user .fobs :
428
+ new_users_by_fob [fob ] = user
420
429
if (
421
430
not user .invited_to_checkr
422
431
and user .email is not None
0 commit comments