1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-18 07:23:03 +08:00

Compare commits

...

1 Commits

Author SHA1 Message Date
KenanZhu a8789ad743 fix(LibReserve): fix the failure to select nearest reserve time when the max time difference is 0
The previous implementation only considered the case when more than one nearest time exists,
so we introduced the prefer_early flag to decide which one to be selected.But the comparsion
mistakenly omitted the edge case when the difference is 0.
2025-11-06 20:07:43 +08:00
+2 -2
View File
@@ -403,9 +403,9 @@ class LibReserve(LibOperator):
if abs_diff < best_time_diff or (
abs_diff == best_time_diff and (
# prefer earlier time
(prefer_earlier and actual_diff < 0) or
(prefer_earlier and actual_diff <= 0) or
# prefer later time
(not prefer_earlier and actual_diff > 0)
(not prefer_earlier and actual_diff >= 0)
)
):
best_time_diff = abs_diff