Skip to content

Commit 9c8a2b8

Browse files
committed
Update bestTask() to select CERTs with priority
1 parent c01cab8 commit 9c8a2b8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Worktodo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ std::optional<Task> parse(const std::string& line) {
9292
return {};
9393
}
9494

95-
// Among the valid tasks from fileName, return the "best" which means with the smallest exponent
95+
// Among the valid tasks from fileName, return the "best" which means the smallest CERT, or otherwise the exponent PRP/LL
9696
static std::optional<Task> bestTask(const fs::path& fileName) {
9797
optional<Task> best;
9898
for (const string& line : File::openRead(fileName)) {
9999
optional<Task> task = parse(line);
100-
if (task && (!best || task->exponent < best->exponent)) { best = task; }
100+
if (task && (!best
101+
|| (best->kind != Task::CERT && task->kind == Task::CERT)
102+
|| ((best->kind != Task::CERT || task->kind == Task::CERT) && task->exponent < best->exponent))) {
103+
best = task;
104+
}
101105
}
102106
return best;
103107
}

0 commit comments

Comments
 (0)