|
@@ -298,7 +298,25 @@ void ExecutionController::listExecutions(const httplib::Request& req, httplib::R
|
|
|
if (canSeeExecution(ctx, execution)) visible.push_back(execution);
|
|
if (canSeeExecution(ctx, execution)) visible.push_back(execution);
|
|
|
}
|
|
}
|
|
|
response["executions"] = visible;
|
|
response["executions"] = visible;
|
|
|
- response["total"] = visible.size();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // The count of the collection, not of this page.
|
|
|
|
|
+ //
|
|
|
|
|
+ // It used to be visible.size(), so a page of twenty answered "20 of 20"
|
|
|
|
|
+ // against sixteen hundred records while hasMore said otherwise. The database
|
|
|
|
|
+ // reports the real total for the filters given - checked directly: 1,589
|
|
|
|
|
+ // unfiltered and 1,452 for status=completed, whatever the limit - so the
|
|
|
|
|
+ // number was being thrown away here rather than never known.
|
|
|
|
|
+ //
|
|
|
|
|
+ // The per-row check above no longer removes anything on this path, because
|
|
|
|
|
+ // the query is now restricted to workflows the caller can reach. If the two
|
|
|
|
|
+ // ever disagree the total would overstate what was shown, so say so rather
|
|
|
|
|
+ // than let it drift quietly.
|
|
|
|
|
+ const auto dropped = result.value().documents.size() - visible.size();
|
|
|
|
|
+ if (dropped > 0) {
|
|
|
|
|
+ LOG_WARN("Executions listing dropped {} row(s) after the query; the total is the "
|
|
|
|
|
+ "query's and now overstates what is visible", dropped);
|
|
|
|
|
+ }
|
|
|
|
|
+ response["total"] = result.value().total_count;
|
|
|
response["page"] = page;
|
|
response["page"] = page;
|
|
|
response["pageSize"] = page_size;
|
|
response["pageSize"] = page_size;
|
|
|
response["hasMore"] = result.value().has_more;
|
|
response["hasMore"] = result.value().has_more;
|