@@ -431,7 +431,7 @@ async def _fetch_accessory_report(
431431 # state variables
432432 cur_keys_primary : set [str ] = set ()
433433 cur_keys_secondary : set [str ] = set ()
434- cur_index = accessory .get_min_index (start_date )
434+ cur_index = accessory .get_max_index (start_date )
435435 ret : set [LocationReport ] = set ()
436436
437437 async def _fetch () -> set [LocationReport ]:
@@ -446,17 +446,15 @@ async def _fetch() -> set[LocationReport]:
446446 report .decrypt (key )
447447
448448 # update alignment data on every report
449- # if a key maps to multiple indices, only feed it the maximum index,
450- # since apple only returns the latest reports per request.
451- # This makes the value more likely to be stable.
452- accessory .update_alignment (report .timestamp , max (key_to_ind [key ]))
449+ for i in key_to_ind [key ]:
450+ accessory .update_alignment (report .timestamp , i )
453451
454452 cur_keys_primary .clear ()
455453 cur_keys_secondary .clear ()
456454
457455 return set (new_reports )
458456
459- while cur_index < = accessory .get_max_index (end_date ):
457+ while cur_index > = accessory .get_min_index (end_date ):
460458 key_batch = accessory .keys_at (cur_index )
461459
462460 # split into primary and secondary keys
@@ -483,7 +481,7 @@ async def _fetch() -> set[LocationReport]:
483481 cur_keys_primary |= new_keys_primary
484482 cur_keys_secondary |= new_keys_secondary
485483
486- cur_index + = 1
484+ cur_index - = 1
487485
488486 if cur_keys_primary or cur_keys_secondary :
489487 # fetch remaining keys
0 commit comments