Better account-based wait status

This commit is contained in:
alejo committed 2026-10-28 13:11:54 -03:00
1 parent 10badb282c
commit 33567db5a3
14 files changed
+183 -57

No files matched your search

+2
View File
@@ -46,6 +46,8 @@ public:
void setTaskAccount(const std::string& name, const std::optional<std::string>& account);
void setTaskStatus(const std::string& name, const std::string& status);
void setTaskNotes(const std::string& name, const std::string& notes);
void setTaskWaitOverride(const std::string& name, bool value);
void clearWaitOverrides(const std::string& account); // every task of the account follows its wait again
private:
using Param = std::optional<std::string>;
+1
View File
@@ -8,6 +8,7 @@ struct TaskRow {
std::optional<std::string> account;
std::string status; // serialized, see StatusUtil::serialize
std::string notes; // free text, any length (stored as SQLite TEXT)
bool waitOverride = false; // set to Testing / Prompt while its account waits: ignores that wait
};
struct AccountRow {
+1 -2
View File
@@ -72,9 +72,8 @@ private:
std::string existingAccount(const std::string& name) const;
TaskRow existingTask(const std::string& name) const;
std::optional<std::time_t> runningWait(const std::string& account) const;
void resumeAccount(const std::string& account);
void taskInUse(const std::string& taskName, const std::string& accountName);
void makeTaskFollowAccount(const TaskRow& task);
void noteAccountWait(const std::string& taskName);
void note(const std::string& message);
Database& db_;
+3
View File
@@ -28,6 +28,9 @@ struct TaskInfo {
Status storedStatus; // what is saved underneath
std::string notes;
std::size_t noteLines = 0;
// Set to Testing / Prompt while its account waits: it shows its own status
// and ignores the wait, while the account's other tasks keep following it.
bool overridesWait = false;
};
struct AccountInfo {
+6 -1
View File
@@ -16,7 +16,11 @@
* or just "wait" (only while the task's account is already waiting).
* - A wait belongs to the account: setting a task to "wait <time>" sets its
* account's wait, and the account's Prompt / Testing tasks then show Wait
* until that time and Limit reset after it (see the README).
* until that time and Limit reset after it. A task you explicitly set to
* "testing" or "prompt" while the wait is running shows that status instead
* (overrides_wait = 1) and the other tasks keep waiting; "wait" makes it follow
* the account again. If the wait is already over (Limit reset), setting a task
* to testing / prompt clears it: the account is in use again (see the README).
* - Times are Unix seconds (UTC); clock-time text like "4:30pm" is read in the
* local time zone, and a time that has passed today means tomorrow.
*
@@ -88,6 +92,7 @@ typedef struct lls_task_info {
int64_t until; /* for Wait / Limit reset: when the wait ends (ended); else 0 */
const char* notes; /* the full text, "" if none (any length) */
int notes_lines; /* number of lines in the notes */
int overrides_wait; /* 1 if its account waits but this task ignores it (set to Testing / Prompt) */
} lls_task_info;
/* An account with its computed state. */