Skip to content

Commit

Permalink
Fix comparator for direct assignment ordering (#288)
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <yadunund@openrobotics.org>
  • Loading branch information
Yadunund committed Jul 27, 2023
1 parent 6caa604 commit 4f92a92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rmf_fleet_adapter/src/rmf_fleet_adapter/TaskManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ class TaskManager : public std::enable_shared_from_this<TaskManager>
{
bool operator()(const DirectAssignment& a, const DirectAssignment& b) const
{
// Sort by start time and then sequence_number if tie
// Sort by ascending order of start time and then sequence_number if tie.
const auto start_time_b =
b.assignment.request()->booking()->earliest_start_time();
const auto start_time_a =
a.assignment.request()->booking()->earliest_start_time();

if (start_time_b == start_time_a)
{
return b.sequence_number < a.sequence_number;
return a.sequence_number < b.sequence_number;
}

return start_time_b < start_time_a;
return start_time_a < start_time_b;
}
};

Expand Down

0 comments on commit 4f92a92

Please sign in to comment.