diff --git a/openapi.yaml b/openapi.yaml index cc8732a..af9c000 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13615,8 +13615,14 @@ paths: **Search the library**. Besides `id`, `type`, `name` and `owner`: - **survey**: `description`, `intervals` (its Shared Intervals in order), `question_grids` - (`{outcome_id, heading, questions}`), `scoring` (`{questions, verdicts}` when it is scored) and `questions` in - the order the Survey shows them. A question has `question` (its wording), `mandatory` and + (`{outcome_id, heading, questions}`), `scoring` (`{questions, verdicts}` when it is scored), `outcomes` and + `questions` in the order the Survey shows them. `outcomes` lists each Outcome the Survey's + Metrics are in as `{id, name, catch_all, other_metric_count, warning}`: every Project using + the Survey gets all the Metrics in these Outcomes, and `other_metric_count` is how many of + them the Survey doesn't ask about. `warning` is `true` when that is more than 5, or when the + Outcome is a catch-all (an organisation's Becoming Able, Influencing Behaviour or Achieving + Growth, or a person's Not Yet Categorised Outcome) holding any other Metric, so you can show + the same hint as the Survey editor. A question has `question` (its wording), `mandatory` and `item` (the Metric, List, Field or Activity tracker behind it, with `metric_type`, `unit` and `choices` where they apply), `by_interval` when it is reworded or hidden in an Interval, and `display_if` (a list) and `skip_to` when it has those rules (see **Create a @@ -14012,6 +14018,11 @@ paths: yes/no, use a scale Metric on a Yes - No List, not a binary Metric. A Survey can't skip to its end. Anything else is `422`, naming the question. + **Choosing an Outcome.** Every Project using the Survey gets all the Metrics in its questions' + Outcomes. The response's `outcomes` says how many other Metrics each Outcome adds + (`other_metric_count`) and sets `warning` when that is a lot; create a right-sized Outcome + with `POST /outcomes` rather than using a catch-all. + **Question Grids.** `question_grids: [{outcome_id, questions}]` shows scale questions that measure one Outcome first and share one List as one table, headed by the Outcome's title. Every scale question of that Outcome in the Survey must be in the grid, on the same List, and diff --git a/server.js b/server.js index a41ce86..e6d6c7e 100644 --- a/server.js +++ b/server.js @@ -2857,7 +2857,7 @@ function buildDocsPage() { { name: "item_type", in: "path", type: "string", required: true, desc: "The item's type, as returned by Search the library" }, { name: "id", in: "path", type: "integer", required: true, desc: "The item's id" } ], [ - { code: "200", cls: "response-2xx", desc: "The item: a Survey's questions in order with the Metric, List or Field behind each, its intervals and any by_interval wording; a Metric's type, default question, Unit, List and Outcomes; a List's choices; a form's fields; a framework's stages; a toolkit's contents" }, + { code: "200", cls: "response-2xx", desc: "The item: a Survey's questions in order with the Metric, List or Field behind each, its intervals, any by_interval wording and its outcomes with how many other Metrics each adds to Projects using it (other_metric_count, warning); a Metric's type, default question, Unit, List and Outcomes; a List's choices; a form's fields; a framework's stages; a toolkit's contents" }, { code: "404", cls: "response-4xx", desc: "Not found, or not visible to you" }, { code: "422", cls: "response-4xx", desc: "Unknown item_type" } ])} @@ -2963,7 +2963,7 @@ function buildDocsPage() { { name: "approved", in: "body", type: "boolean", required: false, desc: "Makerble staff only: show it to every organisation and approve its new Metrics and Lists" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create new items even though near-identical ones exist (see 409)" } ], [ - { code: "201", cls: "response-2xx", desc: "Created: data is the Survey as Get a library item shows it, with its intervals and questions in order (each with any by_interval wording), plus approved" }, + { code: "201", cls: "response-2xx", desc: "Created: data is the Survey as Get a library item shows it, with its intervals, questions in order (each with any by_interval wording) and outcomes (each Outcome's other_metric_count and warning), plus approved" }, { code: "401", cls: "response-4xx", desc: "Missing or invalid token" }, { code: "403", cls: "response-4xx", desc: "You may not create Surveys, as in the Makerble app" }, { code: "404", cls: "response-4xx", desc: "The organisation, or an id in a question, isn't one you can use; the error names the question" }, @@ -2995,7 +2995,7 @@ function buildDocsPage() { { name: "changes", in: "body", type: "array", required: true, desc: "In order, each applied to the questions as the changes before it left them. Each has an action: add (question, optional number), remove (number), replace (number, question) or move (number, to). A question is as in Create a Survey with its questions" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create new items even though near-identical ones exist" } ], [ - { code: "200", cls: "response-2xx", desc: "Changed: data is the Survey as Get a library item shows it, with its questions in their new order" }, + { code: "200", cls: "response-2xx", desc: "Changed: data is the Survey as Get a library item shows it, with its questions in their new order and outcomes saying how many other Metrics each Outcome adds to Projects using it" }, { code: "401", cls: "response-4xx", desc: "Missing or invalid token" }, { code: "403", cls: "response-4xx", desc: "You can see it but may not change it, e.g. another organisation's public item" }, { code: "404", cls: "response-4xx", desc: "Not one you can see" },