Limits are now account-tied rather than task-tied

This commit is contained in:
alejo committed 2026-10-24 09:13:03 -03:00
1 parent 315a2102a7
commit 0af468f47c
9 files changed
+235 -14

No files matched your search

+3
View File
@@ -32,6 +32,9 @@ public:
void addAccount(const std::string& name);
void removeAccount(const std::string& name);
void renameAccount(const std::string& name, const std::string& newName);
std::optional<AccountRow> getAccount(const std::string& name) const;
std::vector<AccountRow> listAccountRows() const;
void setAccountCooldown(const std::string& name, const std::optional<std::string>& cooldown);
// Tasks
std::optional<std::string> findTask(const std::string& name) const; // canonical spelling
+5
View File
@@ -9,3 +9,8 @@ struct TaskRow {
std::string status; // serialized, see StatusUtil::serialize
std::string notes; // free text, any length (stored as SQLite TEXT)
};
struct AccountRow {
std::string id;
std::optional<std::string> cooldown; // the account's wait: when its limit ends (StatusUtil::timeToText)
};
+4
View File
@@ -37,6 +37,8 @@ private:
void execute(const std::string& line);
void refresh() const;
void say(const std::string& message);
void setAccountWait(const std::string& account, std::time_t until);
void noteAccountWait(const std::string& taskName);
void flushMessages();
void endOfInput();
bool confirm(const std::string& question) const;
@@ -49,6 +51,8 @@ private:
bool cmdAccAdd(const Args& args);
bool cmdAccDel(const Args& args);
bool cmdAccRename(const Args& args);
bool cmdAccWait(const Args& args);
bool cmdAccUnwait(const Args& args);
bool cmdAccLs(const Args& args);
// Task commands
+14
View File
@@ -26,9 +26,23 @@ std::optional<Status> parse(const std::string& text, std::time_t now);
std::string serialize(const Status& status);
std::optional<Status> deserialize(const std::string& text);
// Prompt and Testing tasks follow their account's wait; Uploading, Frozen and
// Done tasks do not.
bool followsAccountWait(StatusKind kind);
// The status to show for a task. If its account has a wait, the tasks that
// follow it show Wait until then and Limit reset after; otherwise the stored
// status is used (see effective).
Status resolve(const Status& stored, const std::optional<std::time_t>& accountWait, std::time_t now);
// The status shown to the user: an expired wait becomes LimitReset.
Status effective(const Status& status, std::time_t now);
// Times kept outside a Status (an account's cooldown): "2026-10-17T16:30".
std::string timeToText(std::time_t value);
std::optional<std::time_t> timeFromText(const std::string& text);
std::string clockLabel(std::time_t value); // "16:30"
std::string label(const Status& status); // "Prompt", "Limit reset", "Wait 16:30", ...
std::string kindName(StatusKind kind); // lowercase token: "prompt", "limit-reset", ...
std::vector<StatusKind> allKinds();