mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Update sort.cpp
This commit is contained in:
parent
803f4a5017
commit
32d14bc085
1 changed files with 7 additions and 6 deletions
13
src/sort.cpp
13
src/sort.cpp
|
@ -49,7 +49,6 @@ void sort_tasks (
|
|||
const std::string& keys)
|
||||
{
|
||||
Timer timer;
|
||||
|
||||
global_data = &data;
|
||||
|
||||
// Split the key defs.
|
||||
|
@ -76,16 +75,18 @@ void sort_projects (
|
|||
for (auto& parent : parents)
|
||||
{
|
||||
parent_pos = std::find_if (sorted.begin (), sorted.end (),
|
||||
[&parent](const std::pair <std::string, int>& item) { return item.first == parent; }
|
||||
);
|
||||
[&parent](const std::pair <std::string, int>& item) { return item.first == parent; });
|
||||
|
||||
// if parent does not exist yet: insert into sorted view
|
||||
if (parent_pos == sorted.end ()) {
|
||||
if (parent_pos == sorted.end ())
|
||||
sorted.push_back (std::make_pair (parent, 1));
|
||||
}
|
||||
}
|
||||
|
||||
// insert new element below latest parent
|
||||
sorted.insert ((parent_pos == sorted.end ()) ? parent_pos : ++parent_pos, project);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// if has no parents: simply push to end of list
|
||||
sorted.push_back (project);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue