Status system reworked
This commit is contained in:
1 parent
33567db5a3
commit
a29ba6e4d2
18 files changed
+326
-345
No files matched your search
@@ -75,8 +75,8 @@ goes back to `$VISUAL` / `$EDITOR` / nano / vim / vi. The choice is stored in
|
||||
`db backup` writes a copy, `db restore` loads a file. On `quit` you are asked
|
||||
to save if there are unsaved changes (`y` save, `n` discard, `c` cancel the
|
||||
exit); any other answer asks again, so a mistyped key never loses data.
|
||||
* The stored status is never shown directly: a `wait` task displays as
|
||||
`Wait HH:MM` until that time passes, then as `Limit reset`. Tasks are sorted
|
||||
* The stored status is not always what is shown: a `wait` task displays as
|
||||
`Wait HH:MM` until its account's wait ends, then as `Limit reset`. Tasks are sorted
|
||||
by computed status (Limit reset, Testing, Prompt, Wait, Uploading, Frozen,
|
||||
Done); Wait and Limit reset tasks then sort by time (earliest first: when
|
||||
the wait ends / ended), then account A-Z (unassigned last), then name. The panels are cleared and redrawn after changes.
|
||||
@@ -88,29 +88,22 @@ goes back to `$VISUAL` / `$EDITOR` / nano / vim / vi. The choice is stored in
|
||||
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).
|
||||
* Waits belong to the account: `acc wait <name> <time>` (or `tsk restat <task> wait
|
||||
<time>`, which sets its account's wait). Until the time the account's Prompt
|
||||
and Testing tasks show `Wait HH:MM`; after it they show `Limit reset`, until
|
||||
you run `acc unwait <name>`. Uploading, Frozen and Done tasks are not
|
||||
affected, and the tasks keep their own stored status underneath. A wait that
|
||||
no task shows (no tasks, or only Done / Frozen / Uploading ones) is listed in
|
||||
the account row as `(wait)` or `(limit reset)` and keeps the account Busy.
|
||||
Tasks without an account keep their own wait.
|
||||
* A task you set explicitly to `testing` or `prompt` (`tsk restat <task>
|
||||
testing`, `tsk add <task> <acc> testing`) shows that status, even while its
|
||||
account is waiting: that task ignores the wait, and the account's other tasks
|
||||
keep following it. `tsk restat <task> wait` (no time) makes it follow the
|
||||
wait again, and a new `acc wait` or `acc unwait` applies to every task again.
|
||||
Adding a task without a status leaves it following the account.
|
||||
* Auto unwait: once an account's limit has reset (its tasks show `Limit reset`),
|
||||
setting a task on it explicitly to `testing` or `prompt` clears that finished
|
||||
wait, because the account is in use again, and its tasks go back to their own
|
||||
status. A wait that is still running is never cleared automatically (use
|
||||
`acc unwait`).
|
||||
* A time is only optional while the account is already waiting: then
|
||||
`tsk restat <task> wait` (or `tsk add <task> <acc> wait`) just makes the task
|
||||
follow that wait. Otherwise (no account, or its wait is over) a time is
|
||||
required. Old databases with per-task waits are converted on load.
|
||||
* Waits: an account hits its limit until a time (`acc wait <name> <time>`). A task
|
||||
that is **set to `wait`** is waiting for that: `tsk restat <task> wait <time>`
|
||||
sets its account's wait to the time and marks the task Wait (several waiting
|
||||
tasks share the account's time), and `tsk restat <task> wait` with no time marks
|
||||
it Wait while the account is already waiting (otherwise a time is required).
|
||||
Tasks without an account keep their own wait time.
|
||||
* When the time passes the account stops waiting by itself, and every task that
|
||||
was Wait now shows `Limit reset`: the conversation can be continued. Those
|
||||
tasks stay Limit reset until you set them to something else. `acc unwait
|
||||
<name>` ends the wait early, with the same result.
|
||||
* Prompt and Testing tasks are not waiting: they show as they are, with
|
||||
`(account-waiting)` added while their account waits, e.g. `Testing
|
||||
(account-waiting)`. The account row shows when the wait ends in the RESET
|
||||
column, and stays Busy while it waits; if none of its tasks is set to Wait
|
||||
(e.g. you deleted them) its TASKS column lists `(wait)`.
|
||||
* Old databases with per-task waits are converted on load.
|
||||
* Deleting an account leaves its tasks unassigned (`-`).
|
||||
* Names are case-insensitive; the original spelling is kept.
|
||||
* Notes live in the database (SQLite TEXT, binary-safe, SQLite's default limit is ~1 GB). The task table shows `-` when a task has no notes, otherwise the number of lines (e.g. `3 lines`); open them with `tsk notes <name>`.
|
||||
@@ -129,13 +122,13 @@ against it behaves exactly like typing the commands. Build it with the project
|
||||
|
||||
lls_account_add(db, "Acrux");
|
||||
lls_task_add(db, "Breeze A", "Acrux", "testing");
|
||||
lls_account_set_wait(db, "Acrux", "4:30pm"); /* the account hit its limit */
|
||||
lls_task_add(db, "Breeze B", "Acrux", "wait 4:30pm"); /* Acrux hit its limit; Breeze B waits for it */
|
||||
|
||||
lls_task_list* tasks;
|
||||
lls_tasks(db, &tasks); /* display order */
|
||||
for (int i = 0; i < lls_task_list_count(tasks); ++i) {
|
||||
const lls_task_info* t = lls_task_list_get(tasks, i);
|
||||
printf("%s %s\n", t->name, t->status_label); /* "Breeze A Wait 16:30" */
|
||||
printf("%s %s\n", t->name, t->status_label); /* "Breeze A Testing (account-waiting)" ... */
|
||||
}
|
||||
lls_task_list_free(tasks);
|
||||
|
||||
@@ -148,9 +141,11 @@ against it behaves exactly like typing the commands. Build it with the project
|
||||
* After a change, `lls_last_messages(db)` holds what the prompt would have
|
||||
printed ("Account 'A' is back in use: ..."). Queries do not reset it.
|
||||
* Statuses are the text you would type: `"prompt"`, `"testing"`, `"wait 4:30pm"`,
|
||||
`"wait"` (only while the account is waiting)... Waits belong to the account;
|
||||
a task set to `"testing"` / `"prompt"` while it waits ignores the wait
|
||||
(`overrides_wait` is 1) and `"wait"` makes it follow the account again.
|
||||
`"wait"` (only while the account is waiting)... A task set to wait waits for
|
||||
its account; when the time passes the account stops waiting by itself and
|
||||
those tasks show Limit reset. Prompt / Testing tasks keep their status, with
|
||||
`(account-waiting)` in `status_label` (and `account_waiting` = 1) while the
|
||||
account waits.
|
||||
* `lls_tasks` / `lls_accounts` return lists in the order of the panels, with the
|
||||
computed status (`status`, `status_label`, `until`) and the stored one underneath
|
||||
(`stored_status`). Strings in a list are valid until `lls_task_list_free`.
|
||||
@@ -165,7 +160,7 @@ against it behaves exactly like typing the commands. Build it with the project
|
||||
with lls.Database("tasks.db") as db:
|
||||
db.add_account("Acrux")
|
||||
db.add_task("Breeze A", account="Acrux", status="testing")
|
||||
db.set_account_wait("Acrux", "4:30pm")
|
||||
db.add_task("Breeze B", account="Acrux", status="wait 4:30pm") # sets Acrux's wait
|
||||
for task in db.tasks():
|
||||
print(task.name, task.account, task.status_label, task.until)
|
||||
for account in db.accounts():
|
||||
|
||||
Reference in new issue
Block a user