|
@@ -453,7 +453,7 @@ def match_local_aardbei(aardbei_members: List[AardbeiMember]) -> AardbeiLink:
|
453
|
453
|
|
454
|
454
|
for member in aardbei_members:
|
455
|
455
|
p: Optional[Person] = Person.query.filter_by(
|
456
|
|
- aardbei_id=member.aardbei_id
|
|
456
|
+ aardbei_id=member.person.aardbei_id
|
457
|
457
|
).one_or_none()
|
458
|
458
|
|
459
|
459
|
if p is not None:
|
|
@@ -492,14 +492,14 @@ def link_matches(matches: List[AardbeiMatch]) -> None:
|
492
|
492
|
"""
|
493
|
493
|
|
494
|
494
|
for match in matches:
|
495
|
|
- match.local.aardbei_id = match.remote.aardbei_id
|
|
495
|
+ match.local.aardbei_id = match.remote.person.aardbei_id
|
496
|
496
|
match.local.display_name = match.remote.display_name
|
497
|
497
|
logging.info(
|
498
|
498
|
"Linking local %s (%s) to remote %s (%s)",
|
499
|
499
|
match.local.full_name,
|
500
|
500
|
match.local.person_id,
|
501
|
501
|
match.remote.display_name,
|
502
|
|
- match.remote.aardbei_id,
|
|
502
|
+ match.remote.person.aardbei_id,
|
503
|
503
|
)
|
504
|
504
|
|
505
|
505
|
db.session.add(match.local)
|
|
@@ -516,14 +516,14 @@ def create_missing(missing: List[AardbeiMember]) -> None:
|
516
|
516
|
pnew = Person(
|
517
|
517
|
full_name=member.person.full_name,
|
518
|
518
|
display_name=member.display_name,
|
519
|
|
- aardbei_id=member.aardbei_id,
|
|
519
|
+ aardbei_id=member.person.aardbei_id,
|
520
|
520
|
active=False,
|
521
|
521
|
)
|
522
|
522
|
logging.info(
|
523
|
523
|
"Creating new person for %s / %s (%s)",
|
524
|
524
|
member.person.full_name,
|
525
|
525
|
member.display_name,
|
526
|
|
- member.aardbei_id,
|
|
526
|
+ member.person.aardbei_id,
|
527
|
527
|
)
|
528
|
528
|
db.session.add(pnew)
|
529
|
529
|
|
|
@@ -603,7 +603,7 @@ def get_activities(
|
603
|
603
|
for item in resp.json():
|
604
|
604
|
result.append(SparseAardbeiActivity.from_aardbei_dict(item))
|
605
|
605
|
|
606
|
|
- now = datetime.datetime.now()
|
|
606
|
+ now = datetime.datetime.now(datetime.timezone.utc)
|
607
|
607
|
result.sort(key=lambda x: SparseAardbeiActivity.distance(x, now))
|
608
|
608
|
return result
|
609
|
609
|
|
|
@@ -640,7 +640,7 @@ def match_activity(activity: AardbeiActivity) -> None:
|
640
|
640
|
activity as active, and all other people as inactive.
|
641
|
641
|
"""
|
642
|
642
|
ps = activity.participants
|
643
|
|
- pids: List[PersonId] = [p.person.aardbei_id for p in ps]
|
|
643
|
+ pids: List[PersonId] = [p.person.aardbei_id for p in ps if p.attending]
|
644
|
644
|
|
645
|
645
|
Person.query.update(values={"active": False})
|
646
|
646
|
Person.query.filter(Person.aardbei_id.in_(pids)).update(
|