mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-16 17:44:08 +00:00
feat(ugc): models with no bricks are "empty", not failed
A model with no bricks has nothing to make: it gets its own state (is_optimized = 3), isn't counted as a failure or retried, shows as Empty on the UGC page (with its own filter and count), in the status and in Prometheus, and its downloads answer 404 like HKX. State names come from the enum (magic_enum). Migrations dlu/mysql/87 and dlu/sqlite/70 move the rows that failed only because they had no bricks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,9 +65,10 @@ namespace {
|
||||
// The UGC server's queue in the database (its work list), from the model and modular build tables
|
||||
nlohmann::json UgcCounts() {
|
||||
const auto counts = [](const std::vector<std::pair<IUgc::eProcessState, uint64_t>>& rows) {
|
||||
nlohmann::json out = { {"pending", 0}, {"done", 0}, {"failed", 0} };
|
||||
nlohmann::json out = nlohmann::json::object();
|
||||
for (const auto state : magic_enum::enum_values<IUgc::eProcessState>()) out[IUgc::ProcessStateName(state)] = 0;
|
||||
for (const auto& [state, count] : rows) {
|
||||
out[state == IUgc::eProcessState::PENDING ? "pending" : state == IUgc::eProcessState::DONE ? "done" : "failed"] = count;
|
||||
out[IUgc::ProcessStateName(state)] = count;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user