diff --git a/README.md b/README.md index 72fa2d4..32a9874 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,9 @@ goes back to `$VISUAL` / `$EDITOR` / nano / vim / vi. The choice is stored in * Account panel: one row per account, judged by its tasks: `Busy` if any is Testing, Limit reset or Wait; else `Taken` if any is Prompt; else `Free` (only Done, Frozen or Uploading tasks, or no tasks). The TASKS column lists - the tasks at that level. Rows are sorted most free first: Free, Taken, Busy, - fewer tasks first, ties by name (see `levelOf` in `Display.cpp` and + the tasks at that level, so a Free account shows its Uploading, Frozen and + Done tasks (`-` if it has none). Rows are sorted most free first: Free, Taken, Busy; + within Taken and Busy fewer tasks first, ties by name (see `levelOf` in `Display.cpp` and `StatusUtil::isBusy` / `isTaken` to change the rules). * Deleting an account leaves its tasks unassigned (`-`). * Names are case-insensitive; the original spelling is kept. diff --git a/src/Display.cpp b/src/Display.cpp index 71dce66..77882d2 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -127,7 +127,8 @@ std::string Display::renderAccounts(std::time_t now) const { std::sort(views.begin(), views.end(), taskLess); // One row per account. Its level is the most taken of its tasks - // (Busy > Taken > Free); the TASKS column lists the tasks at that level. + // (Busy > Taken > Free); the TASKS column lists the tasks at that level + // (for a Free account that is its Uploading, Frozen and Done tasks). struct AccountView { std::string name; AccountLevel level; @@ -138,6 +139,7 @@ std::string Display::renderAccounts(std::time_t now) const { for (const std::string& account : db_.listAccounts()) { std::vector busy; std::vector taken; + std::vector free; for (const TaskView& view : views) { if (view.account != account) { continue; @@ -147,6 +149,8 @@ std::string Display::renderAccounts(std::time_t now) const { busy.push_back(view.name); } else if (level == AccountLevel::Taken) { taken.push_back(view.name); + } else { + free.push_back(view.name); } } @@ -160,17 +164,19 @@ std::string Display::renderAccounts(std::time_t now) const { entry.tasks = taken; } else { entry.level = AccountLevel::Free; + entry.tasks = free; } accounts.push_back(entry); } - // Most free first: Free, then Taken, then Busy; within a level fewer tasks - // first. listAccounts is alphabetical and stable_sort keeps that for ties. + // Most free first: Free, then Taken, then Busy; within Taken and Busy fewer + // tasks first (Free accounts are all equally free). listAccounts is + // alphabetical and stable_sort keeps that order for ties. std::stable_sort(accounts.begin(), accounts.end(), [](const AccountView& a, const AccountView& b) { if (a.level != b.level) { return levelRank(a.level) < levelRank(b.level); } - return a.tasks.size() < b.tasks.size(); + return a.level != AccountLevel::Free && a.tasks.size() < b.tasks.size(); }); TextTable table({"ACCOUNT", "STATUS", "TASKS"});