@stage5/lumine 0.3.66 → 0.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin-arena.js +21 -1
- package/package.json +1 -1
package/lib/admin-arena.js
CHANGED
|
@@ -14,7 +14,7 @@ import path from "node:path";
|
|
|
14
14
|
// re-importing a folder retires that paper's earlier items
|
|
15
15
|
// status --item <id> --to live|retired|checked
|
|
16
16
|
export const ARENA_USAGE =
|
|
17
|
-
"Usage: lumine admin arena queue | import --dir <paper folder> [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked [--confirm] [--json]";
|
|
17
|
+
"Usage: lumine admin arena queue | marking [--cursor <id>] [--limit <1-200>] | import --dir <paper folder> [--audio audio/<exam>/<paper>] [--live] [--confirm] | status --item <id> --to live|retired|checked [--confirm] [--json]";
|
|
18
18
|
const MAX_ITEMS = 300;
|
|
19
19
|
|
|
20
20
|
function validationError(message) {
|
|
@@ -50,6 +50,18 @@ function readPaper(dir) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function buildArenaOperation({ action, options }) {
|
|
53
|
+
if (action === "marking") {
|
|
54
|
+
const cursor = Number(options.adminCursor || 0);
|
|
55
|
+
const limit = Number(options.adminLimit ?? 100);
|
|
56
|
+
if (!Number.isSafeInteger(cursor) || cursor < 0 || !Number.isInteger(limit) || limit < 1 || limit > 200) {
|
|
57
|
+
throw validationError("Use a non-negative --cursor and --limit from 1 to 200.");
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
name: "arena.marking", method: "GET",
|
|
61
|
+
path: `/cli/admin/arena/marking?cursor=${cursor}&limit=${limit}`,
|
|
62
|
+
body: undefined, mutates: false, requiresRun: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
53
65
|
if (!action || action === "queue") {
|
|
54
66
|
return {
|
|
55
67
|
name: "arena.queue",
|
|
@@ -102,6 +114,14 @@ export function buildArenaOperation({ action, options }) {
|
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
export function formatArenaResult({ operation, data }) {
|
|
117
|
+
if (operation.name === "arena.marking") {
|
|
118
|
+
const entries = data?.entries || [];
|
|
119
|
+
return [
|
|
120
|
+
`Checked ${data?.scannedBattles ?? 0} completed battles; ${entries.length} need follow-up on this page.`,
|
|
121
|
+
...entries.map((row) => `Battle ${row.battleId}, member ${row.userId}, ${row.examKey}: ${row.reasons.join(", ")} (${row.pendingAnswers} answers pending; ${row.xpEarned}/${row.xpExpected} XP and ${row.coinsEarned}/${row.coinsExpected} Coins paid)`),
|
|
122
|
+
...(data?.nextCursor ? [`Continue: lumine admin arena marking --cursor ${data.nextCursor} --json`] : ["End of marking/reward census."]),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
105
125
|
if (operation.name === "arena.queue") {
|
|
106
126
|
const types = data?.types || [];
|
|
107
127
|
if (!types.length) return ["No live Arena items yet."];
|