Files
LLS/include/Display.h
T
alejo 6cb5a8611f Task sorting
- Time: Wait tasks sort by when the wait ends, earliest first. Limit reset tasks sort by when their wait ended, so the one that has been ready longest comes first. The time is kept when a wait expires, which is what makes the second sort possible.
- Order: I put time before account for these two statuses, so the full order is status, then time, then account, then name. Other statuses still go status, account, name. If you'd rather have account before time, swap the two checks in taskLess in Display.cpp.
- Manual limit reset: a task you set to limit-reset by hand has no wait time, so it sorts first among limit resets.

Account status: an account takes the most taken level among its tasks.
- Busy: it has a Testing, Limit reset or Wait task. The TASKS column lists those tasks.
- Taken: it has a Prompt task and nothing Busy. The TASKS column lists the Prompt tasks.
- Free: it only has Done, Frozen or Uploading tasks, or no tasks. The TASKS column shows

 Changes to be committed:
	modified:   README.md
	modified:   include/Display.h
	modified:   include/Status.h
	modified:   src/Completer.cpp
	modified:   src/Display.cpp
	modified:   src/Repl.cpp
	modified:   src/Status.cpp
2026-10-18 21:50:24 -03:00

41 lines
1.2 KiB
C++

#pragma once
#include <ctime>
#include <set>
#include <string>
#include "Database.h"
#include "Status.h"
// How taken an account is, judged by its tasks:
// Free - only Done, Frozen or Uploading tasks, or no tasks
// Taken - has a Prompt task (and nothing Busy)
// Busy - has a Testing, Limit reset or Wait task
enum class AccountLevel { Busy, Taken, Free };
std::string accountLevelName(AccountLevel level); // "busy", "taken", "free"
struct DisplaySettings {
bool showTasks = true; // auto-print the task table after each change
bool showAccounts = true; // auto-print the account table after each change
std::set<StatusKind> hiddenTaskLevels;
std::set<AccountLevel> hiddenAccountLevels;
};
// Builds the computed views. The status shown is derived from the stored
// status and the current time, never copied straight from the database.
class Display {
public:
explicit Display(const Database& db);
DisplaySettings& settings();
const DisplaySettings& settings() const;
std::string renderTasks(std::time_t now) const;
std::string renderAccounts(std::time_t now) const;
private:
const Database& db_;
DisplaySettings settings_;
};