| 45 |
45 |
|
//! what *that field* came back with. A described screen that narrowed the
|
| 46 |
46 |
|
//! operators itself would be a second copy of `audiofiles_core::rules`.
|
| 47 |
47 |
|
//!
|
| 48 |
|
- |
//! # THE FINDING: a repeating question repeats one field, and a condition is three
|
|
48 |
+ |
//! # THE FINDING, and what closed it: a repeating question repeated one field
|
| 49 |
49 |
|
//!
|
| 50 |
50 |
|
//! The task filed against this port named [`Field::repeats`] as the member to
|
| 51 |
51 |
|
//! read first, on the reading that a rule's conditions are one question
|
| 54 |
54 |
|
//! together — and [`Repeat`] holds a `Vec<Instance>` where an instance is one
|
| 55 |
55 |
|
//! value and one error. An action is two questions the same way.
|
| 56 |
56 |
|
//!
|
| 57 |
|
- |
//! So the editor does not use it. Each condition is a [`Node::Region`] holding
|
| 58 |
|
- |
//! its three fields, with its own remove act, and "Add condition" is an act
|
| 59 |
|
- |
//! rather than a renderer's add control. That says everything honestly and
|
| 60 |
|
- |
//! loses one thing the member would have given: a renderer has no way to know
|
| 61 |
|
- |
//! the regions are slots of one repeating question, so nothing can draw them as
|
| 62 |
|
- |
//! a list that grows. Filed on quasicoherent rather than worked around further.
|
|
57 |
+ |
//! So the editor could not use it, and what it lost was stated here: a renderer
|
|
58 |
+ |
//! had no way to know the regions were slots of one repeating question, so
|
|
59 |
+ |
//! nothing could number them or draw them as a list that grows, and "at least
|
|
60 |
+ |
//! one condition" was this file disabling its own last Remove.
|
|
61 |
+ |
//!
|
|
62 |
+ |
//! **Closed by quasicoherent `f7abbc08`** (Max chose c): [`Slot::repeating`]
|
|
63 |
+ |
//! says a region's children are answers to one question, and [`Slot::removes`]
|
|
64 |
+ |
//! says what takes one away. `Repeat` is untouched — it is still a repeating
|
|
65 |
+ |
//! *field*, and this is a repeating *group*. Both groups here say it now, and
|
|
66 |
+ |
//! the floor is [`Repeating::least`] rather than an `unless` in this file.
|
| 63 |
67 |
|
//!
|
| 64 |
68 |
|
//! Two consumers here, not one: conditions (three fields) and actions (two).
|
| 65 |
|
- |
//! Both are in the same editor, which is what makes this a shape rather than a
|
| 66 |
|
- |
//! quirk of one screen.
|
|
69 |
+ |
//! Both are in the same editor, which is what made this a shape rather than a
|
|
70 |
+ |
//! quirk of one screen, and what the ruling was measured against.
|
| 67 |
71 |
|
//!
|
| 68 |
72 |
|
//! # THE SECOND FINDING: a description cannot say "write when the control settles"
|
| 69 |
73 |
|
//!
|
| 118 |
122 |
|
//! [`Field::repeats`]: quasi_router::Field::repeats
|
| 119 |
123 |
|
//! [`Outcome::File`]: quasi_router::Outcome::File
|
| 120 |
124 |
|
//! [`Repeat`]: quasi_router::Repeat
|
|
125 |
+ |
//! [`Repeating::least`]: quasi_router::Repeating::least
|
|
126 |
+ |
//! [`Slot::removes`]: quasi_router::Slot::removes
|
|
127 |
+ |
//! [`Slot::repeating`]: quasi_router::Slot::repeating
|
| 121 |
128 |
|
|
| 122 |
129 |
|
use quasi_router::layout::{FieldKind, Readiness as Ready, Tone};
|
| 123 |
130 |
|
use quasi_router::{
|
| 124 |
|
- |
Accepted, Act, Action, Choice, Field, Locating, Node, RegionKind, Request, Response,
|
|
131 |
+ |
Accepted, Act, Action, Choice, Field, Locating, Node, RegionKind, Repeating, Request, Response,
|
| 125 |
132 |
|
RouteError, Router, Row, Screen, Slot, Sought, Tag,
|
| 126 |
133 |
|
};
|
| 127 |
134 |
|
|
| 837 |
844 |
|
)))
|
| 838 |
845 |
|
.with(Node::section("When"));
|
| 839 |
846 |
|
|
|
847 |
+ |
// The conditions and the actions, each as slots of one repeating question.
|
|
848 |
+ |
// quasicoherent `f7abbc08`: the regions were always here and nothing said
|
|
849 |
+ |
// they were slots, so no renderer could number them and "at least one
|
|
850 |
+ |
// condition" was this file disabling its own last Remove.
|
|
851 |
+ |
//
|
|
852 |
+ |
// `least(1)` is that rule, said once. `least(0)` on the actions is the
|
|
853 |
+ |
// honest answer for them: a rule with no actions is describable and the
|
|
854 |
+ |
// editor has never stopped anyone writing one.
|
| 840 |
855 |
|
let testable = state.classifier.testable();
|
| 841 |
|
- |
let removable = draft.conditions.len() > 1;
|
|
856 |
+ |
let mut conditions = Slot::new("conditions", RegionKind::Group).repeating(
|
|
857 |
+ |
Repeating::new(
|
|
858 |
+ |
"Condition",
|
|
859 |
+ |
Act::new(
|
|
860 |
+ |
"Add condition",
|
|
861 |
+ |
Action::post("/classifier/draft/conditions/add"),
|
|
862 |
+ |
),
|
|
863 |
+ |
)
|
|
864 |
+ |
.least(1),
|
|
865 |
+ |
);
|
| 842 |
866 |
|
for (at, condition) in draft.conditions.iter().enumerate() {
|
| 843 |
|
- |
body = body.with(condition_region(at, condition, &testable, removable));
|
|
867 |
+ |
conditions = conditions.with(condition_region(at, condition, &testable));
|
| 844 |
868 |
|
}
|
| 845 |
|
- |
body = body.with(Node::Act(Act::new(
|
| 846 |
|
- |
"Add condition",
|
| 847 |
|
- |
Action::post("/classifier/draft/conditions/add"),
|
| 848 |
|
- |
)));
|
|
869 |
+ |
body = body.with(Node::Region(conditions));
|
| 849 |
870 |
|
|
| 850 |
871 |
|
body = body.with(Node::section("Then"));
|
|
872 |
+ |
let mut actions = Slot::new("actions", RegionKind::Group).repeating(Repeating::new(
|
|
873 |
+ |
"Action",
|
|
874 |
+ |
Act::new("Add action", Action::post("/classifier/draft/actions/add")),
|
|
875 |
+ |
));
|
| 851 |
876 |
|
for (at, action) in draft.actions.iter().enumerate() {
|
| 852 |
|
- |
body = body.with(action_region(at, action));
|
|
877 |
+ |
actions = actions.with(action_region(at, action));
|
| 853 |
878 |
|
}
|
| 854 |
|
- |
body = body.with(Node::Act(Act::new(
|
| 855 |
|
- |
"Add action",
|
| 856 |
|
- |
Action::post("/classifier/draft/actions/add"),
|
| 857 |
|
- |
)));
|
|
879 |
+ |
body = body.with(Node::Region(actions));
|
| 858 |
880 |
|
|
| 859 |
881 |
|
body = body
|
| 860 |
882 |
|
.with(Node::text("Count how many samples match, without writing."))
|
| 878 |
900 |
|
))
|
| 879 |
901 |
|
}
|
| 880 |
902 |
|
|
| 881 |
|
- |
/// One condition, as three questions grouped.
|
|
903 |
+ |
/// One condition, as three questions grouped: one slot of a repeating question.
|
| 882 |
904 |
|
///
|
| 883 |
|
- |
/// See the module header's first finding: this is what a repeating question
|
| 884 |
|
- |
/// would have been if a slot could hold more than one field.
|
| 885 |
|
- |
fn condition_region(
|
| 886 |
|
- |
at: usize,
|
| 887 |
|
- |
condition: &super::Testing,
|
| 888 |
|
- |
testable: &[super::Testable],
|
| 889 |
|
- |
removable: bool,
|
| 890 |
|
- |
) -> Node {
|
|
905 |
+ |
/// See the module header's first finding and what closed it. This region says
|
|
906 |
+ |
/// what takes it away and its parent says how few may be left standing, so the
|
|
907 |
+ |
/// floor is the description's rather than this file's.
|
|
908 |
+ |
fn condition_region(at: usize, condition: &super::Testing, testable: &[super::Testable]) -> Node {
|
| 891 |
909 |
|
let chosen = testable.iter().find(|field| field.value == condition.field);
|
| 892 |
910 |
|
|
| 893 |
911 |
|
let field = Field::select(
|
| 939 |
957 |
|
)));
|
| 940 |
958 |
|
}
|
| 941 |
959 |
|
|
| 942 |
|
- |
// The last condition cannot be removed, which the shipped editor enforced
|
| 943 |
|
- |
// by disabling its button. Offered dead rather than hidden, on the rule
|
| 944 |
|
- |
// `library`'s last-vault Delete follows.
|
| 945 |
|
- |
Node::Region(region.with(Node::Act(unless(
|
| 946 |
|
- |
Act::new(
|
| 947 |
|
- |
"Remove condition",
|
| 948 |
|
- |
Action::post(format!("/classifier/draft/conditions/{at}/remove")),
|
| 949 |
|
- |
),
|
| 950 |
|
- |
!removable,
|
| 951 |
|
- |
))))
|
|
960 |
+ |
// The last condition cannot be removed. This file used to say so by
|
|
961 |
+ |
// disabling its own button; `Repeating::least` says it now, and every
|
|
962 |
+ |
// renderer draws it dead rather than hidden -- the rule `library`'s
|
|
963 |
+ |
// last-vault Delete follows, and the one this editor already followed.
|
|
964 |
+ |
Node::Region(region.removes(Act::new(
|
|
965 |
+ |
"Remove condition",
|
|
966 |
+ |
Action::post(format!("/classifier/draft/conditions/{at}/remove")),
|
|
967 |
+ |
)))
|
| 952 |
968 |
|
}
|
| 953 |
969 |
|
|
| 954 |
|
- |
/// One action, as two questions grouped.
|
|
970 |
+ |
/// One action, as two questions grouped: one slot of a repeating question.
|
| 955 |
971 |
|
fn action_region(at: usize, action: &super::Doing) -> Node {
|
| 956 |
972 |
|
let kind = Field::select(
|
| 957 |
973 |
|
"kind",
|
| 980 |
996 |
|
region = region.with(Node::Field(Box::new(tag)));
|
| 981 |
997 |
|
}
|
| 982 |
998 |
|
|
| 983 |
|
- |
Node::Region(region.with(Node::Act(Act::new(
|
|
999 |
+ |
Node::Region(region.removes(Act::new(
|
| 984 |
1000 |
|
"Remove action",
|
| 985 |
1001 |
|
Action::post(format!("/classifier/draft/actions/{at}/remove")),
|
| 986 |
|
- |
))))
|
|
1002 |
+ |
)))
|
| 987 |
1003 |
|
}
|
| 988 |
1004 |
|
|
| 989 |
1005 |
|
/// Auto-Tagging: the pass, the review door, the head, and the thresholds.
|