|
@@ -252,7 +252,7 @@ namespace ClankerSaddle.Services {
|
|
|
progress = yield list_progress(id),
|
|
progress = yield list_progress(id),
|
|
|
sessions = yield db.query<Session>()
|
|
sessions = yield db.query<Session>()
|
|
|
.where(expr("task_id == $0", elem<int64?>(id)))
|
|
.where(expr("task_id == $0", elem<int64?>(id)))
|
|
|
- .order_by(expr("id"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async()
|
|
.materialise_async()
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
@@ -333,9 +333,12 @@ namespace ClankerSaddle.Services {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Lists tasks, optionally filtered by status and/or project, ordered
|
|
|
|
|
- * by priority (1 first) then creation time — filtered and sorted
|
|
|
|
|
- * in the query, one materialisation.
|
|
|
|
|
|
|
+ * Lists tasks, optionally filtered by status and/or project,
|
|
|
|
|
+ * newest first (creation descending, id as the same-second
|
|
|
|
|
+ * tiebreak) — the list-page consistency sweep: every table
|
|
|
|
|
+ * leads with the most recent row. Priority stays a visible
|
|
|
|
|
+ * column, no longer a sort key; the dispatcher's candidate
|
|
|
|
|
+ * order ({@link get_ready_tasks}) keeps priority-first.
|
|
|
*/
|
|
*/
|
|
|
public async ImmutableLot<TaskEntity> list_tasks(string? status, int64? project_id) throws Error {
|
|
public async ImmutableLot<TaskEntity> list_tasks(string? status, int64? project_id) throws Error {
|
|
|
var query = db.query<TaskEntity>();
|
|
var query = db.query<TaskEntity>();
|
|
@@ -346,24 +349,24 @@ namespace ClankerSaddle.Services {
|
|
|
query.where(expr("project_id == $0", elem<int64?>(project_id)));
|
|
query.where(expr("project_id == $0", elem<int64?>(project_id)));
|
|
|
}
|
|
}
|
|
|
return yield query
|
|
return yield query
|
|
|
- .order_by(expr("priority"))
|
|
|
|
|
- .order_by(expr("created_at"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("created_at"))
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async();
|
|
.materialise_async();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Every standalone human-workable task row (kind task, no
|
|
* Every standalone human-workable task row (kind task, no
|
|
|
- * goal), any status, ordered like {@link list_tasks} — the
|
|
|
|
|
- * auto-enqueue-after dropdowns' option list, queried for
|
|
|
|
|
- * exactly the rows they show instead of every task in the
|
|
|
|
|
- * table.
|
|
|
|
|
|
|
+ * goal), any status, ordered like {@link list_tasks}
|
|
|
|
|
+ * (newest first) — the auto-enqueue-after dropdowns' option
|
|
|
|
|
+ * list, queried for exactly the rows they show instead of
|
|
|
|
|
+ * every task in the table.
|
|
|
*/
|
|
*/
|
|
|
public async ImmutableLot<TaskEntity> list_standalone_tasks() throws Error {
|
|
public async ImmutableLot<TaskEntity> list_standalone_tasks() throws Error {
|
|
|
return yield db.query<TaskEntity>()
|
|
return yield db.query<TaskEntity>()
|
|
|
.where(expr("kind == $0 && goal_id == $1",
|
|
.where(expr("kind == $0 && goal_id == $1",
|
|
|
elem(TASK_KIND_TASK), elem<int64?>(0)))
|
|
elem(TASK_KIND_TASK), elem<int64?>(0)))
|
|
|
- .order_by(expr("priority"))
|
|
|
|
|
- .order_by(expr("created_at"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("created_at"))
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async();
|
|
.materialise_async();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -519,11 +522,11 @@ namespace ClankerSaddle.Services {
|
|
|
return task;
|
|
return task;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** Every task under `goal_id` (both kinds), oldest first. */
|
|
|
|
|
|
|
+ /** Every task under `goal_id` (both kinds), newest first. */
|
|
|
public async ImmutableLot<TaskEntity> list_tasks_for_goal(int64 goal_id) throws Error {
|
|
public async ImmutableLot<TaskEntity> list_tasks_for_goal(int64 goal_id) throws Error {
|
|
|
return yield db.query<TaskEntity>()
|
|
return yield db.query<TaskEntity>()
|
|
|
.where(expr("goal_id == $0", elem<int64?>(goal_id)))
|
|
.where(expr("goal_id == $0", elem<int64?>(goal_id)))
|
|
|
- .order_by(expr("id"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async();
|
|
.materialise_async();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1542,29 +1545,33 @@ namespace ClankerSaddle.Services {
|
|
|
return rows.to_immutable_buffer();
|
|
return rows.to_immutable_buffer();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** Comments on a task, oldest first. */
|
|
|
|
|
|
|
+ /** Comments on a task, newest first — the thread leads with
|
|
|
|
|
+ * the latest remark (the list-page consistency sweep). */
|
|
|
public async ImmutableLot<TaskComment> list_comments(int64 task_id) throws Error {
|
|
public async ImmutableLot<TaskComment> list_comments(int64 task_id) throws Error {
|
|
|
return yield db.query<TaskComment>()
|
|
return yield db.query<TaskComment>()
|
|
|
.where(expr("task_id == $0", elem<int64?>(task_id)))
|
|
.where(expr("task_id == $0", elem<int64?>(task_id)))
|
|
|
- .order_by(expr("id"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async();
|
|
.materialise_async();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** Blocks on a task, oldest first. */
|
|
|
|
|
|
|
+ /** Blocks on a task, newest first — the blocking sections
|
|
|
|
|
+ * lead with the most recent question, RFC or review (the
|
|
|
|
|
+ * list-page consistency sweep). */
|
|
|
public async ImmutableLot<TaskBlock> list_blocks(int64 task_id) throws Error {
|
|
public async ImmutableLot<TaskBlock> list_blocks(int64 task_id) throws Error {
|
|
|
return yield db.query<TaskBlock>()
|
|
return yield db.query<TaskBlock>()
|
|
|
.where(expr("task_id == $0", elem<int64?>(task_id)))
|
|
.where(expr("task_id == $0", elem<int64?>(task_id)))
|
|
|
- .order_by(expr("id"))
|
|
|
|
|
|
|
+ .order_by_desc(expr("id"))
|
|
|
.materialise_async();
|
|
.materialise_async();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** The task's newest block, or null when it has none. */
|
|
|
|
|
|
|
+ /** The task's newest block, or null when it has none — the
|
|
|
|
|
+ * FIRST row (list_blocks is newest-first since the ordering
|
|
|
|
|
+ * sweep; the walker keeps the semantics explicit). */
|
|
|
public async TaskBlock? newest_block(int64 task_id) throws Error {
|
|
public async TaskBlock? newest_block(int64 task_id) throws Error {
|
|
|
- TaskBlock? newest = null;
|
|
|
|
|
foreach (var block in yield list_blocks(task_id)) {
|
|
foreach (var block in yield list_blocks(task_id)) {
|
|
|
- newest = block;
|
|
|
|
|
|
|
+ return block;
|
|
|
}
|
|
}
|
|
|
- return newest;
|
|
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|