@doenet/v06-to-v07 0.7.0-beta5 → 0.7.0-beta7
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/index.js +606 -434
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -67460,10 +67460,467 @@ class MathList extends CompositeComponent {
|
|
|
67460
67460
|
return { replacementChanges, nComponents };
|
|
67461
67461
|
}
|
|
67462
67462
|
}
|
|
67463
|
+
function returnScoredSectionAttributes() {
|
|
67464
|
+
return {
|
|
67465
|
+
aggregateScores: {
|
|
67466
|
+
createComponentOfType: "boolean",
|
|
67467
|
+
createStateVariable: "aggregateScoresPreliminary",
|
|
67468
|
+
defaultValue: false
|
|
67469
|
+
},
|
|
67470
|
+
weight: {
|
|
67471
|
+
createComponentOfType: "number",
|
|
67472
|
+
createStateVariable: "weight",
|
|
67473
|
+
defaultValue: 1,
|
|
67474
|
+
public: true
|
|
67475
|
+
},
|
|
67476
|
+
sectionWideCheckWork: {
|
|
67477
|
+
createComponentOfType: "boolean",
|
|
67478
|
+
createStateVariable: "sectionWideCheckWork",
|
|
67479
|
+
defaultValue: false,
|
|
67480
|
+
public: true
|
|
67481
|
+
},
|
|
67482
|
+
showCorrectness: {
|
|
67483
|
+
createComponentOfType: "boolean",
|
|
67484
|
+
createStateVariable: "showCorrectnessPreliminary",
|
|
67485
|
+
defaultValue: null
|
|
67486
|
+
},
|
|
67487
|
+
submitLabel: {
|
|
67488
|
+
createComponentOfType: "text",
|
|
67489
|
+
createStateVariable: "submitLabel",
|
|
67490
|
+
defaultValue: "Check Work",
|
|
67491
|
+
public: true,
|
|
67492
|
+
forRenderer: true
|
|
67493
|
+
},
|
|
67494
|
+
submitLabelNoCorrectness: {
|
|
67495
|
+
createComponentOfType: "text",
|
|
67496
|
+
createStateVariable: "submitLabelNoCorrectness",
|
|
67497
|
+
defaultValue: "Submit Response",
|
|
67498
|
+
public: true,
|
|
67499
|
+
forRenderer: true
|
|
67500
|
+
},
|
|
67501
|
+
displayDigitsForCreditAchieved: {
|
|
67502
|
+
createComponentOfType: "integer",
|
|
67503
|
+
createStateVariable: "displayDigitsForCreditAchieved",
|
|
67504
|
+
defaultValue: 3,
|
|
67505
|
+
public: true
|
|
67506
|
+
}
|
|
67507
|
+
};
|
|
67508
|
+
}
|
|
67509
|
+
function returnScoredSectionStateVariableDefinition() {
|
|
67510
|
+
const stateVariableDefinitions = {};
|
|
67511
|
+
stateVariableDefinitions.scoredDescendants = {
|
|
67512
|
+
returnDependencies: () => ({
|
|
67513
|
+
scoredDescendants: {
|
|
67514
|
+
dependencyType: "descendant",
|
|
67515
|
+
componentTypes: [
|
|
67516
|
+
"_sectioningComponent",
|
|
67517
|
+
"answer",
|
|
67518
|
+
"setup",
|
|
67519
|
+
"_blockScoredComponent",
|
|
67520
|
+
"p",
|
|
67521
|
+
"li",
|
|
67522
|
+
"div",
|
|
67523
|
+
"span"
|
|
67524
|
+
],
|
|
67525
|
+
variableNames: [
|
|
67526
|
+
"scoredDescendants",
|
|
67527
|
+
"aggregateScores",
|
|
67528
|
+
"weight"
|
|
67529
|
+
],
|
|
67530
|
+
recurseToMatchedChildren: false,
|
|
67531
|
+
variablesOptional: true
|
|
67532
|
+
}
|
|
67533
|
+
}),
|
|
67534
|
+
definition({ dependencyValues }) {
|
|
67535
|
+
let scoredDescendants = [];
|
|
67536
|
+
for (let descendant of dependencyValues.scoredDescendants) {
|
|
67537
|
+
if (descendant.componentType === "setup") {
|
|
67538
|
+
continue;
|
|
67539
|
+
}
|
|
67540
|
+
if (descendant.stateValues.aggregateScores || descendant.stateValues.scoredDescendants === void 0) {
|
|
67541
|
+
scoredDescendants.push(descendant);
|
|
67542
|
+
} else {
|
|
67543
|
+
scoredDescendants.push(
|
|
67544
|
+
...descendant.stateValues.scoredDescendants
|
|
67545
|
+
);
|
|
67546
|
+
}
|
|
67547
|
+
}
|
|
67548
|
+
return { setValue: { scoredDescendants } };
|
|
67549
|
+
}
|
|
67550
|
+
};
|
|
67551
|
+
stateVariableDefinitions.answerDescendants = {
|
|
67552
|
+
returnDependencies: () => ({
|
|
67553
|
+
answerDescendants: {
|
|
67554
|
+
dependencyType: "descendant",
|
|
67555
|
+
componentTypes: ["answer", "_blockScoredComponent"],
|
|
67556
|
+
variableNames: ["justSubmitted"],
|
|
67557
|
+
recurseToMatchedChildren: false
|
|
67558
|
+
}
|
|
67559
|
+
}),
|
|
67560
|
+
definition({ dependencyValues }) {
|
|
67561
|
+
return {
|
|
67562
|
+
setValue: {
|
|
67563
|
+
answerDescendants: dependencyValues.answerDescendants
|
|
67564
|
+
}
|
|
67565
|
+
};
|
|
67566
|
+
}
|
|
67567
|
+
};
|
|
67568
|
+
stateVariableDefinitions.justSubmitted = {
|
|
67569
|
+
forRenderer: true,
|
|
67570
|
+
returnDependencies: () => ({
|
|
67571
|
+
answerDescendants: {
|
|
67572
|
+
dependencyType: "stateVariable",
|
|
67573
|
+
variableName: "answerDescendants"
|
|
67574
|
+
}
|
|
67575
|
+
}),
|
|
67576
|
+
definition({ dependencyValues }) {
|
|
67577
|
+
return {
|
|
67578
|
+
setValue: {
|
|
67579
|
+
justSubmitted: dependencyValues.answerDescendants.every(
|
|
67580
|
+
(x2) => x2.stateValues.justSubmitted
|
|
67581
|
+
)
|
|
67582
|
+
}
|
|
67583
|
+
};
|
|
67584
|
+
}
|
|
67585
|
+
};
|
|
67586
|
+
stateVariableDefinitions.showCorrectness = {
|
|
67587
|
+
forRenderer: true,
|
|
67588
|
+
returnDependencies: () => ({
|
|
67589
|
+
showCorrectnessPreliminary: {
|
|
67590
|
+
dependencyType: "stateVariable",
|
|
67591
|
+
variableName: "showCorrectnessPreliminary"
|
|
67592
|
+
},
|
|
67593
|
+
showCorrectnessFlag: {
|
|
67594
|
+
dependencyType: "flag",
|
|
67595
|
+
flagName: "showCorrectness"
|
|
67596
|
+
}
|
|
67597
|
+
}),
|
|
67598
|
+
definition({ dependencyValues, usedDefault }) {
|
|
67599
|
+
let showCorrectness;
|
|
67600
|
+
if (!usedDefault.showCorrectnessPreliminary) {
|
|
67601
|
+
showCorrectness = dependencyValues.showCorrectnessPreliminary;
|
|
67602
|
+
} else {
|
|
67603
|
+
showCorrectness = dependencyValues.showCorrectnessFlag !== false;
|
|
67604
|
+
}
|
|
67605
|
+
return { setValue: { showCorrectness } };
|
|
67606
|
+
}
|
|
67607
|
+
};
|
|
67608
|
+
stateVariableDefinitions.displayDecimalsForCreditAchieved = {
|
|
67609
|
+
returnDependencies: () => ({}),
|
|
67610
|
+
definition: () => ({
|
|
67611
|
+
setValue: { displayDecimalsForCreditAchieved: -Infinity }
|
|
67612
|
+
})
|
|
67613
|
+
};
|
|
67614
|
+
stateVariableDefinitions.aggregateScores = {
|
|
67615
|
+
public: true,
|
|
67616
|
+
shadowingInstructions: {
|
|
67617
|
+
createComponentOfType: "boolean"
|
|
67618
|
+
},
|
|
67619
|
+
returnDependencies: () => ({
|
|
67620
|
+
aggregateScoresPreliminary: {
|
|
67621
|
+
dependencyType: "stateVariable",
|
|
67622
|
+
variableName: "aggregateScoresPreliminary"
|
|
67623
|
+
},
|
|
67624
|
+
sectionWideCheckWork: {
|
|
67625
|
+
dependencyType: "stateVariable",
|
|
67626
|
+
variableName: "sectionWideCheckWork"
|
|
67627
|
+
}
|
|
67628
|
+
}),
|
|
67629
|
+
definition({ dependencyValues }) {
|
|
67630
|
+
return {
|
|
67631
|
+
setValue: {
|
|
67632
|
+
aggregateScores: dependencyValues.aggregateScoresPreliminary || dependencyValues.sectionWideCheckWork
|
|
67633
|
+
}
|
|
67634
|
+
};
|
|
67635
|
+
}
|
|
67636
|
+
};
|
|
67637
|
+
stateVariableDefinitions.creditAchieved = {
|
|
67638
|
+
public: true,
|
|
67639
|
+
shadowingInstructions: {
|
|
67640
|
+
createComponentOfType: "number",
|
|
67641
|
+
addAttributeComponentsShadowingStateVariables: {
|
|
67642
|
+
displayDigits: {
|
|
67643
|
+
stateVariableToShadow: "displayDigitsForCreditAchieved"
|
|
67644
|
+
},
|
|
67645
|
+
displayDecimals: {
|
|
67646
|
+
stateVariableToShadow: "displayDecimalsForCreditAchieved"
|
|
67647
|
+
}
|
|
67648
|
+
}
|
|
67649
|
+
},
|
|
67650
|
+
forRenderer: true,
|
|
67651
|
+
defaultValue: 0,
|
|
67652
|
+
hasEssential: true,
|
|
67653
|
+
additionalStateVariablesDefined: [
|
|
67654
|
+
{
|
|
67655
|
+
variableName: "percentCreditAchieved",
|
|
67656
|
+
public: true,
|
|
67657
|
+
shadowingInstructions: {
|
|
67658
|
+
createComponentOfType: "number",
|
|
67659
|
+
addAttributeComponentsShadowingStateVariables: {
|
|
67660
|
+
displayDigits: {
|
|
67661
|
+
stateVariableToShadow: "displayDigitsForCreditAchieved"
|
|
67662
|
+
},
|
|
67663
|
+
displayDecimals: {
|
|
67664
|
+
stateVariableToShadow: "displayDecimalsForCreditAchieved"
|
|
67665
|
+
}
|
|
67666
|
+
}
|
|
67667
|
+
},
|
|
67668
|
+
defaultValue: 0,
|
|
67669
|
+
hasEssential: true
|
|
67670
|
+
}
|
|
67671
|
+
],
|
|
67672
|
+
stateVariablesDeterminingDependencies: [
|
|
67673
|
+
"aggregateScores",
|
|
67674
|
+
"scoredDescendants"
|
|
67675
|
+
],
|
|
67676
|
+
returnDependencies({ stateValues }) {
|
|
67677
|
+
let dependencies2 = {
|
|
67678
|
+
aggregateScores: {
|
|
67679
|
+
dependencyType: "stateVariable",
|
|
67680
|
+
variableName: "aggregateScores"
|
|
67681
|
+
}
|
|
67682
|
+
};
|
|
67683
|
+
if (stateValues.aggregateScores) {
|
|
67684
|
+
dependencies2.scoredDescendants = {
|
|
67685
|
+
dependencyType: "stateVariable",
|
|
67686
|
+
variableName: "scoredDescendants"
|
|
67687
|
+
};
|
|
67688
|
+
for (let [
|
|
67689
|
+
ind,
|
|
67690
|
+
descendant
|
|
67691
|
+
] of stateValues.scoredDescendants.entries()) {
|
|
67692
|
+
dependencies2["creditAchieved" + ind] = {
|
|
67693
|
+
dependencyType: "stateVariable",
|
|
67694
|
+
componentIdx: descendant.componentIdx,
|
|
67695
|
+
variableName: "creditAchieved"
|
|
67696
|
+
};
|
|
67697
|
+
}
|
|
67698
|
+
}
|
|
67699
|
+
return dependencies2;
|
|
67700
|
+
},
|
|
67701
|
+
definition({ dependencyValues }) {
|
|
67702
|
+
if (!dependencyValues.aggregateScores) {
|
|
67703
|
+
return {
|
|
67704
|
+
setValue: {
|
|
67705
|
+
creditAchieved: 0,
|
|
67706
|
+
percentCreditAchieved: 0
|
|
67707
|
+
}
|
|
67708
|
+
};
|
|
67709
|
+
}
|
|
67710
|
+
let creditSum = 0;
|
|
67711
|
+
let totalWeight = 0;
|
|
67712
|
+
for (let [
|
|
67713
|
+
ind,
|
|
67714
|
+
component
|
|
67715
|
+
] of dependencyValues.scoredDescendants.entries()) {
|
|
67716
|
+
let weight = component.stateValues.weight;
|
|
67717
|
+
creditSum += dependencyValues["creditAchieved" + ind] * weight;
|
|
67718
|
+
totalWeight += weight;
|
|
67719
|
+
}
|
|
67720
|
+
let creditAchieved;
|
|
67721
|
+
if (totalWeight > 0) {
|
|
67722
|
+
creditAchieved = creditSum / totalWeight;
|
|
67723
|
+
} else {
|
|
67724
|
+
creditAchieved = 1;
|
|
67725
|
+
}
|
|
67726
|
+
let percentCreditAchieved = creditAchieved * 100;
|
|
67727
|
+
return { setValue: { creditAchieved, percentCreditAchieved } };
|
|
67728
|
+
}
|
|
67729
|
+
};
|
|
67730
|
+
stateVariableDefinitions.creditAchievedIfSubmit = {
|
|
67731
|
+
defaultValue: 0,
|
|
67732
|
+
stateVariablesDeterminingDependencies: [
|
|
67733
|
+
"aggregateScores",
|
|
67734
|
+
"scoredDescendants"
|
|
67735
|
+
],
|
|
67736
|
+
returnDependencies({ stateValues }) {
|
|
67737
|
+
let dependencies2 = {
|
|
67738
|
+
aggregateScores: {
|
|
67739
|
+
dependencyType: "stateVariable",
|
|
67740
|
+
variableName: "aggregateScores"
|
|
67741
|
+
}
|
|
67742
|
+
};
|
|
67743
|
+
if (stateValues.aggregateScores) {
|
|
67744
|
+
dependencies2.scoredDescendants = {
|
|
67745
|
+
dependencyType: "stateVariable",
|
|
67746
|
+
variableName: "scoredDescendants"
|
|
67747
|
+
};
|
|
67748
|
+
for (let [
|
|
67749
|
+
ind,
|
|
67750
|
+
descendant
|
|
67751
|
+
] of stateValues.scoredDescendants.entries()) {
|
|
67752
|
+
dependencies2["creditAchievedIfSubmit" + ind] = {
|
|
67753
|
+
dependencyType: "stateVariable",
|
|
67754
|
+
componentIdx: descendant.componentIdx,
|
|
67755
|
+
variableName: "creditAchievedIfSubmit"
|
|
67756
|
+
};
|
|
67757
|
+
}
|
|
67758
|
+
}
|
|
67759
|
+
return dependencies2;
|
|
67760
|
+
},
|
|
67761
|
+
definition({ dependencyValues }) {
|
|
67762
|
+
if (!dependencyValues.aggregateScores) {
|
|
67763
|
+
return {
|
|
67764
|
+
setValue: {
|
|
67765
|
+
creditAchievedIfSubmit: 0
|
|
67766
|
+
}
|
|
67767
|
+
};
|
|
67768
|
+
}
|
|
67769
|
+
let creditSum = 0;
|
|
67770
|
+
let totalWeight = 0;
|
|
67771
|
+
for (let [
|
|
67772
|
+
ind,
|
|
67773
|
+
component
|
|
67774
|
+
] of dependencyValues.scoredDescendants.entries()) {
|
|
67775
|
+
let weight = component.stateValues.weight;
|
|
67776
|
+
creditSum += dependencyValues["creditAchievedIfSubmit" + ind] * weight;
|
|
67777
|
+
totalWeight += weight;
|
|
67778
|
+
}
|
|
67779
|
+
let creditAchievedIfSubmit = creditSum / totalWeight;
|
|
67780
|
+
return { setValue: { creditAchievedIfSubmit } };
|
|
67781
|
+
}
|
|
67782
|
+
};
|
|
67783
|
+
stateVariableDefinitions.createSubmitAllButton = {
|
|
67784
|
+
forRenderer: true,
|
|
67785
|
+
additionalStateVariablesDefined: [
|
|
67786
|
+
{
|
|
67787
|
+
variableName: "suppressAnswerSubmitButtons",
|
|
67788
|
+
forRenderer: true
|
|
67789
|
+
}
|
|
67790
|
+
],
|
|
67791
|
+
returnDependencies: () => ({
|
|
67792
|
+
sectionWideCheckWork: {
|
|
67793
|
+
dependencyType: "stateVariable",
|
|
67794
|
+
variableName: "sectionWideCheckWork"
|
|
67795
|
+
},
|
|
67796
|
+
sectionAncestor: {
|
|
67797
|
+
dependencyType: "ancestor",
|
|
67798
|
+
componentType: "_sectioningComponent",
|
|
67799
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67800
|
+
},
|
|
67801
|
+
documentAncestor: {
|
|
67802
|
+
dependencyType: "ancestor",
|
|
67803
|
+
componentType: "document",
|
|
67804
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67805
|
+
},
|
|
67806
|
+
pAncestor: {
|
|
67807
|
+
dependencyType: "ancestor",
|
|
67808
|
+
componentType: "p",
|
|
67809
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67810
|
+
},
|
|
67811
|
+
liAncestor: {
|
|
67812
|
+
dependencyType: "ancestor",
|
|
67813
|
+
componentType: "li",
|
|
67814
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67815
|
+
},
|
|
67816
|
+
divAncestor: {
|
|
67817
|
+
dependencyType: "ancestor",
|
|
67818
|
+
componentType: "div",
|
|
67819
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67820
|
+
},
|
|
67821
|
+
spanAncestor: {
|
|
67822
|
+
dependencyType: "ancestor",
|
|
67823
|
+
componentType: "span",
|
|
67824
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
67825
|
+
}
|
|
67826
|
+
}),
|
|
67827
|
+
definition({ dependencyValues }) {
|
|
67828
|
+
let warnings = [];
|
|
67829
|
+
let createSubmitAllButton = false;
|
|
67830
|
+
let suppressAnswerSubmitButtons = false;
|
|
67831
|
+
if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons || dependencyValues.sectionAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.pAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.liAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.divAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.spanAncestor?.stateValues.suppressAnswerSubmitButtons) {
|
|
67832
|
+
suppressAnswerSubmitButtons = true;
|
|
67833
|
+
} else if (dependencyValues.sectionWideCheckWork) {
|
|
67834
|
+
createSubmitAllButton = true;
|
|
67835
|
+
suppressAnswerSubmitButtons = true;
|
|
67836
|
+
}
|
|
67837
|
+
return {
|
|
67838
|
+
setValue: {
|
|
67839
|
+
createSubmitAllButton,
|
|
67840
|
+
suppressAnswerSubmitButtons
|
|
67841
|
+
},
|
|
67842
|
+
sendWarnings: warnings
|
|
67843
|
+
};
|
|
67844
|
+
}
|
|
67845
|
+
};
|
|
67846
|
+
stateVariableDefinitions.suppressCheckWork = {
|
|
67847
|
+
forRenderer: true,
|
|
67848
|
+
returnDependencies: () => ({
|
|
67849
|
+
autoSubmit: {
|
|
67850
|
+
dependencyType: "flag",
|
|
67851
|
+
flagName: "autoSubmit"
|
|
67852
|
+
}
|
|
67853
|
+
}),
|
|
67854
|
+
definition({ dependencyValues }) {
|
|
67855
|
+
return {
|
|
67856
|
+
setValue: {
|
|
67857
|
+
suppressCheckWork: dependencyValues.autoSubmit
|
|
67858
|
+
}
|
|
67859
|
+
};
|
|
67860
|
+
}
|
|
67861
|
+
};
|
|
67862
|
+
stateVariableDefinitions.showCheckWork = {
|
|
67863
|
+
forRenderer: true,
|
|
67864
|
+
returnDependencies: () => ({
|
|
67865
|
+
createSubmitAllButton: {
|
|
67866
|
+
dependencyType: "stateVariable",
|
|
67867
|
+
variableName: "createSubmitAllButton"
|
|
67868
|
+
},
|
|
67869
|
+
suppressCheckWork: {
|
|
67870
|
+
dependencyType: "stateVariable",
|
|
67871
|
+
variableName: "suppressCheckWork"
|
|
67872
|
+
}
|
|
67873
|
+
}),
|
|
67874
|
+
definition({ dependencyValues }) {
|
|
67875
|
+
return {
|
|
67876
|
+
setValue: {
|
|
67877
|
+
showCheckWork: dependencyValues.createSubmitAllButton && !dependencyValues.suppressCheckWork
|
|
67878
|
+
}
|
|
67879
|
+
};
|
|
67880
|
+
}
|
|
67881
|
+
};
|
|
67882
|
+
return stateVariableDefinitions;
|
|
67883
|
+
}
|
|
67884
|
+
async function submitAllAnswers({
|
|
67885
|
+
component,
|
|
67886
|
+
actionId,
|
|
67887
|
+
sourceInformation = {},
|
|
67888
|
+
skipRendererUpdate = false
|
|
67889
|
+
}) {
|
|
67890
|
+
component.coreFunctions.requestRecordEvent({
|
|
67891
|
+
verb: "submitted",
|
|
67892
|
+
object: {
|
|
67893
|
+
componentIdx: component.componentIdx,
|
|
67894
|
+
componentType: component.componentType
|
|
67895
|
+
},
|
|
67896
|
+
result: {
|
|
67897
|
+
creditAchieved: await component.stateValues.creditAchievedIfSubmit
|
|
67898
|
+
}
|
|
67899
|
+
});
|
|
67900
|
+
let answersToSubmit = [];
|
|
67901
|
+
for (let answer of await component.stateValues.answerDescendants) {
|
|
67902
|
+
if (!await answer.stateValues.justSubmitted) {
|
|
67903
|
+
answersToSubmit.push(answer);
|
|
67904
|
+
}
|
|
67905
|
+
}
|
|
67906
|
+
let numAnswers = answersToSubmit.length;
|
|
67907
|
+
for (let [ind, answer] of answersToSubmit.entries()) {
|
|
67908
|
+
await component.coreFunctions.performAction({
|
|
67909
|
+
componentIdx: answer.componentIdx,
|
|
67910
|
+
actionName: "submitAnswer",
|
|
67911
|
+
args: {
|
|
67912
|
+
actionId,
|
|
67913
|
+
sourceInformation,
|
|
67914
|
+
skipRendererUpdate: skipRendererUpdate || ind < numAnswers - 1
|
|
67915
|
+
}
|
|
67916
|
+
});
|
|
67917
|
+
}
|
|
67918
|
+
}
|
|
67463
67919
|
class Div extends BlockComponent {
|
|
67464
67920
|
constructor(args) {
|
|
67465
67921
|
super(args);
|
|
67466
67922
|
Object.assign(this.actions, {
|
|
67923
|
+
submitAllAnswers: this.submitAllAnswers.bind(this),
|
|
67467
67924
|
recordVisibilityChange: this.recordVisibilityChange.bind(this)
|
|
67468
67925
|
});
|
|
67469
67926
|
}
|
|
@@ -67472,6 +67929,12 @@ class Div extends BlockComponent {
|
|
|
67472
67929
|
static renderChildren = true;
|
|
67473
67930
|
static canDisplayChildErrors = true;
|
|
67474
67931
|
static includeBlankStringChildren = true;
|
|
67932
|
+
static createAttributesObject() {
|
|
67933
|
+
let attributes = super.createAttributesObject();
|
|
67934
|
+
let scoredSectionAttributes = returnScoredSectionAttributes();
|
|
67935
|
+
Object.assign(attributes, scoredSectionAttributes);
|
|
67936
|
+
return attributes;
|
|
67937
|
+
}
|
|
67475
67938
|
static returnChildGroups() {
|
|
67476
67939
|
return [
|
|
67477
67940
|
{
|
|
@@ -67480,6 +67943,26 @@ class Div extends BlockComponent {
|
|
|
67480
67943
|
}
|
|
67481
67944
|
];
|
|
67482
67945
|
}
|
|
67946
|
+
static returnStateVariableDefinitions() {
|
|
67947
|
+
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
67948
|
+
Object.assign(
|
|
67949
|
+
stateVariableDefinitions,
|
|
67950
|
+
returnScoredSectionStateVariableDefinition()
|
|
67951
|
+
);
|
|
67952
|
+
return stateVariableDefinitions;
|
|
67953
|
+
}
|
|
67954
|
+
async submitAllAnswers({
|
|
67955
|
+
actionId,
|
|
67956
|
+
sourceInformation = {},
|
|
67957
|
+
skipRendererUpdate = false
|
|
67958
|
+
}) {
|
|
67959
|
+
return submitAllAnswers({
|
|
67960
|
+
component: this,
|
|
67961
|
+
actionId,
|
|
67962
|
+
sourceInformation,
|
|
67963
|
+
skipRendererUpdate
|
|
67964
|
+
});
|
|
67965
|
+
}
|
|
67483
67966
|
recordVisibilityChange({ isVisible }) {
|
|
67484
67967
|
this.coreFunctions.requestRecordEvent({
|
|
67485
67968
|
verb: "visibilityChanged",
|
|
@@ -67492,11 +67975,23 @@ class Div extends BlockComponent {
|
|
|
67492
67975
|
}
|
|
67493
67976
|
}
|
|
67494
67977
|
class Span extends InlineComponent {
|
|
67978
|
+
constructor(args) {
|
|
67979
|
+
super(args);
|
|
67980
|
+
Object.assign(this.actions, {
|
|
67981
|
+
submitAllAnswers: this.submitAllAnswers.bind(this)
|
|
67982
|
+
});
|
|
67983
|
+
}
|
|
67495
67984
|
static componentType = "span";
|
|
67496
67985
|
static rendererType = "containerInline";
|
|
67497
67986
|
static renderChildren = true;
|
|
67498
67987
|
static canDisplayChildErrors = true;
|
|
67499
67988
|
static includeBlankStringChildren = true;
|
|
67989
|
+
static createAttributesObject() {
|
|
67990
|
+
let attributes = super.createAttributesObject();
|
|
67991
|
+
let scoredSectionAttributes = returnScoredSectionAttributes();
|
|
67992
|
+
Object.assign(attributes, scoredSectionAttributes);
|
|
67993
|
+
return attributes;
|
|
67994
|
+
}
|
|
67500
67995
|
static returnChildGroups() {
|
|
67501
67996
|
return [
|
|
67502
67997
|
{
|
|
@@ -67505,6 +68000,26 @@ class Span extends InlineComponent {
|
|
|
67505
68000
|
}
|
|
67506
68001
|
];
|
|
67507
68002
|
}
|
|
68003
|
+
static returnStateVariableDefinitions() {
|
|
68004
|
+
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
68005
|
+
Object.assign(
|
|
68006
|
+
stateVariableDefinitions,
|
|
68007
|
+
returnScoredSectionStateVariableDefinition()
|
|
68008
|
+
);
|
|
68009
|
+
return stateVariableDefinitions;
|
|
68010
|
+
}
|
|
68011
|
+
async submitAllAnswers({
|
|
68012
|
+
actionId,
|
|
68013
|
+
sourceInformation = {},
|
|
68014
|
+
skipRendererUpdate = false
|
|
68015
|
+
}) {
|
|
68016
|
+
return submitAllAnswers({
|
|
68017
|
+
component: this,
|
|
68018
|
+
actionId,
|
|
68019
|
+
sourceInformation,
|
|
68020
|
+
skipRendererUpdate
|
|
68021
|
+
});
|
|
68022
|
+
}
|
|
67508
68023
|
}
|
|
67509
68024
|
const Divisions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
67510
68025
|
__proto__: null,
|
|
@@ -80506,109 +81021,6 @@ function returnFeedbackDefinitionStateVariables() {
|
|
|
80506
81021
|
};
|
|
80507
81022
|
return stateVariableDefinitions;
|
|
80508
81023
|
}
|
|
80509
|
-
function returnScoredSectionStateVariableDefinition() {
|
|
80510
|
-
const stateVariableDefinitions = {};
|
|
80511
|
-
stateVariableDefinitions.scoredDescendants = {
|
|
80512
|
-
returnDependencies: () => ({
|
|
80513
|
-
scoredDescendants: {
|
|
80514
|
-
dependencyType: "descendant",
|
|
80515
|
-
componentTypes: [
|
|
80516
|
-
"_sectioningComponent",
|
|
80517
|
-
"answer",
|
|
80518
|
-
"setup",
|
|
80519
|
-
"_blockScoredComponent"
|
|
80520
|
-
],
|
|
80521
|
-
variableNames: [
|
|
80522
|
-
"scoredDescendants",
|
|
80523
|
-
"aggregateScores",
|
|
80524
|
-
"weight"
|
|
80525
|
-
],
|
|
80526
|
-
recurseToMatchedChildren: false,
|
|
80527
|
-
variablesOptional: true
|
|
80528
|
-
}
|
|
80529
|
-
}),
|
|
80530
|
-
definition({ dependencyValues }) {
|
|
80531
|
-
let scoredDescendants = [];
|
|
80532
|
-
for (let descendant of dependencyValues.scoredDescendants) {
|
|
80533
|
-
if (descendant.componentType === "setup") {
|
|
80534
|
-
continue;
|
|
80535
|
-
}
|
|
80536
|
-
if (descendant.stateValues.aggregateScores || descendant.stateValues.scoredDescendants === void 0) {
|
|
80537
|
-
scoredDescendants.push(descendant);
|
|
80538
|
-
} else {
|
|
80539
|
-
scoredDescendants.push(
|
|
80540
|
-
...descendant.stateValues.scoredDescendants
|
|
80541
|
-
);
|
|
80542
|
-
}
|
|
80543
|
-
}
|
|
80544
|
-
return { setValue: { scoredDescendants } };
|
|
80545
|
-
}
|
|
80546
|
-
};
|
|
80547
|
-
stateVariableDefinitions.answerDescendants = {
|
|
80548
|
-
returnDependencies: () => ({
|
|
80549
|
-
answerDescendants: {
|
|
80550
|
-
dependencyType: "descendant",
|
|
80551
|
-
componentTypes: ["answer", "_blockScoredComponent"],
|
|
80552
|
-
variableNames: ["justSubmitted"],
|
|
80553
|
-
recurseToMatchedChildren: false
|
|
80554
|
-
}
|
|
80555
|
-
}),
|
|
80556
|
-
definition({ dependencyValues }) {
|
|
80557
|
-
return {
|
|
80558
|
-
setValue: {
|
|
80559
|
-
answerDescendants: dependencyValues.answerDescendants
|
|
80560
|
-
}
|
|
80561
|
-
};
|
|
80562
|
-
}
|
|
80563
|
-
};
|
|
80564
|
-
stateVariableDefinitions.justSubmitted = {
|
|
80565
|
-
forRenderer: true,
|
|
80566
|
-
returnDependencies: () => ({
|
|
80567
|
-
answerDescendants: {
|
|
80568
|
-
dependencyType: "stateVariable",
|
|
80569
|
-
variableName: "answerDescendants"
|
|
80570
|
-
}
|
|
80571
|
-
}),
|
|
80572
|
-
definition({ dependencyValues }) {
|
|
80573
|
-
return {
|
|
80574
|
-
setValue: {
|
|
80575
|
-
justSubmitted: dependencyValues.answerDescendants.every(
|
|
80576
|
-
(x2) => x2.stateValues.justSubmitted
|
|
80577
|
-
)
|
|
80578
|
-
}
|
|
80579
|
-
};
|
|
80580
|
-
}
|
|
80581
|
-
};
|
|
80582
|
-
stateVariableDefinitions.showCorrectness = {
|
|
80583
|
-
forRenderer: true,
|
|
80584
|
-
returnDependencies: () => ({
|
|
80585
|
-
showCorrectnessPreliminary: {
|
|
80586
|
-
dependencyType: "stateVariable",
|
|
80587
|
-
variableName: "showCorrectnessPreliminary"
|
|
80588
|
-
},
|
|
80589
|
-
showCorrectnessFlag: {
|
|
80590
|
-
dependencyType: "flag",
|
|
80591
|
-
flagName: "showCorrectness"
|
|
80592
|
-
}
|
|
80593
|
-
}),
|
|
80594
|
-
definition({ dependencyValues, usedDefault }) {
|
|
80595
|
-
let showCorrectness;
|
|
80596
|
-
if (!usedDefault.showCorrectnessPreliminary) {
|
|
80597
|
-
showCorrectness = dependencyValues.showCorrectnessPreliminary;
|
|
80598
|
-
} else {
|
|
80599
|
-
showCorrectness = dependencyValues.showCorrectnessFlag !== false;
|
|
80600
|
-
}
|
|
80601
|
-
return { setValue: { showCorrectness } };
|
|
80602
|
-
}
|
|
80603
|
-
};
|
|
80604
|
-
stateVariableDefinitions.displayDecimalsForCreditAchieved = {
|
|
80605
|
-
returnDependencies: () => ({}),
|
|
80606
|
-
definition: () => ({
|
|
80607
|
-
setValue: { displayDecimalsForCreditAchieved: -Infinity }
|
|
80608
|
-
})
|
|
80609
|
-
};
|
|
80610
|
-
return stateVariableDefinitions;
|
|
80611
|
-
}
|
|
80612
81024
|
class SectioningComponent extends BlockComponent {
|
|
80613
81025
|
constructor(args) {
|
|
80614
81026
|
super(args);
|
|
@@ -80626,49 +81038,8 @@ class SectioningComponent extends BlockComponent {
|
|
|
80626
81038
|
static createsVariants = true;
|
|
80627
81039
|
static createAttributesObject() {
|
|
80628
81040
|
let attributes = super.createAttributesObject();
|
|
80629
|
-
|
|
80630
|
-
|
|
80631
|
-
createStateVariable: "aggregateScores",
|
|
80632
|
-
defaultValue: false,
|
|
80633
|
-
public: true
|
|
80634
|
-
};
|
|
80635
|
-
attributes.weight = {
|
|
80636
|
-
createComponentOfType: "number",
|
|
80637
|
-
createStateVariable: "weight",
|
|
80638
|
-
defaultValue: 1,
|
|
80639
|
-
public: true
|
|
80640
|
-
};
|
|
80641
|
-
attributes.sectionWideCheckWork = {
|
|
80642
|
-
createComponentOfType: "boolean",
|
|
80643
|
-
createStateVariable: "sectionWideCheckWork",
|
|
80644
|
-
defaultValue: false,
|
|
80645
|
-
public: true
|
|
80646
|
-
};
|
|
80647
|
-
attributes.showCorrectness = {
|
|
80648
|
-
createComponentOfType: "boolean",
|
|
80649
|
-
createStateVariable: "showCorrectnessPreliminary",
|
|
80650
|
-
defaultValue: null
|
|
80651
|
-
};
|
|
80652
|
-
attributes.submitLabel = {
|
|
80653
|
-
createComponentOfType: "text",
|
|
80654
|
-
createStateVariable: "submitLabel",
|
|
80655
|
-
defaultValue: "Check Work",
|
|
80656
|
-
public: true,
|
|
80657
|
-
forRenderer: true
|
|
80658
|
-
};
|
|
80659
|
-
attributes.submitLabelNoCorrectness = {
|
|
80660
|
-
createComponentOfType: "text",
|
|
80661
|
-
createStateVariable: "submitLabelNoCorrectness",
|
|
80662
|
-
defaultValue: "Submit Response",
|
|
80663
|
-
public: true,
|
|
80664
|
-
forRenderer: true
|
|
80665
|
-
};
|
|
80666
|
-
attributes.displayDigitsForCreditAchieved = {
|
|
80667
|
-
createComponentOfType: "integer",
|
|
80668
|
-
createStateVariable: "displayDigitsForCreditAchieved",
|
|
80669
|
-
defaultValue: 3,
|
|
80670
|
-
public: true
|
|
80671
|
-
};
|
|
81041
|
+
let scoredSectionAttributes = returnScoredSectionAttributes();
|
|
81042
|
+
Object.assign(attributes, scoredSectionAttributes);
|
|
80672
81043
|
attributes.boxed = {
|
|
80673
81044
|
createComponentOfType: "boolean",
|
|
80674
81045
|
createStateVariable: "boxed",
|
|
@@ -81088,152 +81459,6 @@ class SectioningComponent extends BlockComponent {
|
|
|
81088
81459
|
return { setValue: { level } };
|
|
81089
81460
|
}
|
|
81090
81461
|
};
|
|
81091
|
-
stateVariableDefinitions.creditAchieved = {
|
|
81092
|
-
public: true,
|
|
81093
|
-
shadowingInstructions: {
|
|
81094
|
-
createComponentOfType: "number",
|
|
81095
|
-
addAttributeComponentsShadowingStateVariables: {
|
|
81096
|
-
displayDigits: {
|
|
81097
|
-
stateVariableToShadow: "displayDigitsForCreditAchieved"
|
|
81098
|
-
},
|
|
81099
|
-
displayDecimals: {
|
|
81100
|
-
stateVariableToShadow: "displayDecimalsForCreditAchieved"
|
|
81101
|
-
}
|
|
81102
|
-
}
|
|
81103
|
-
},
|
|
81104
|
-
forRenderer: true,
|
|
81105
|
-
defaultValue: 0,
|
|
81106
|
-
hasEssential: true,
|
|
81107
|
-
additionalStateVariablesDefined: [
|
|
81108
|
-
{
|
|
81109
|
-
variableName: "percentCreditAchieved",
|
|
81110
|
-
public: true,
|
|
81111
|
-
shadowingInstructions: {
|
|
81112
|
-
createComponentOfType: "number",
|
|
81113
|
-
addAttributeComponentsShadowingStateVariables: {
|
|
81114
|
-
displayDigits: {
|
|
81115
|
-
stateVariableToShadow: "displayDigitsForCreditAchieved"
|
|
81116
|
-
},
|
|
81117
|
-
displayDecimals: {
|
|
81118
|
-
stateVariableToShadow: "displayDecimalsForCreditAchieved"
|
|
81119
|
-
}
|
|
81120
|
-
}
|
|
81121
|
-
},
|
|
81122
|
-
defaultValue: 0,
|
|
81123
|
-
hasEssential: true
|
|
81124
|
-
}
|
|
81125
|
-
],
|
|
81126
|
-
stateVariablesDeterminingDependencies: [
|
|
81127
|
-
"aggregateScores",
|
|
81128
|
-
"scoredDescendants"
|
|
81129
|
-
],
|
|
81130
|
-
returnDependencies({ stateValues }) {
|
|
81131
|
-
let dependencies2 = {
|
|
81132
|
-
aggregateScores: {
|
|
81133
|
-
dependencyType: "stateVariable",
|
|
81134
|
-
variableName: "aggregateScores"
|
|
81135
|
-
}
|
|
81136
|
-
};
|
|
81137
|
-
if (stateValues.aggregateScores) {
|
|
81138
|
-
dependencies2.scoredDescendants = {
|
|
81139
|
-
dependencyType: "stateVariable",
|
|
81140
|
-
variableName: "scoredDescendants"
|
|
81141
|
-
};
|
|
81142
|
-
for (let [
|
|
81143
|
-
ind,
|
|
81144
|
-
descendant
|
|
81145
|
-
] of stateValues.scoredDescendants.entries()) {
|
|
81146
|
-
dependencies2["creditAchieved" + ind] = {
|
|
81147
|
-
dependencyType: "stateVariable",
|
|
81148
|
-
componentIdx: descendant.componentIdx,
|
|
81149
|
-
variableName: "creditAchieved"
|
|
81150
|
-
};
|
|
81151
|
-
}
|
|
81152
|
-
}
|
|
81153
|
-
return dependencies2;
|
|
81154
|
-
},
|
|
81155
|
-
definition({ dependencyValues }) {
|
|
81156
|
-
if (!dependencyValues.aggregateScores) {
|
|
81157
|
-
return {
|
|
81158
|
-
setValue: {
|
|
81159
|
-
creditAchieved: 0,
|
|
81160
|
-
percentCreditAchieved: 0
|
|
81161
|
-
}
|
|
81162
|
-
};
|
|
81163
|
-
}
|
|
81164
|
-
let creditSum = 0;
|
|
81165
|
-
let totalWeight = 0;
|
|
81166
|
-
for (let [
|
|
81167
|
-
ind,
|
|
81168
|
-
component
|
|
81169
|
-
] of dependencyValues.scoredDescendants.entries()) {
|
|
81170
|
-
let weight = component.stateValues.weight;
|
|
81171
|
-
creditSum += dependencyValues["creditAchieved" + ind] * weight;
|
|
81172
|
-
totalWeight += weight;
|
|
81173
|
-
}
|
|
81174
|
-
let creditAchieved;
|
|
81175
|
-
if (totalWeight > 0) {
|
|
81176
|
-
creditAchieved = creditSum / totalWeight;
|
|
81177
|
-
} else {
|
|
81178
|
-
creditAchieved = 1;
|
|
81179
|
-
}
|
|
81180
|
-
let percentCreditAchieved = creditAchieved * 100;
|
|
81181
|
-
return { setValue: { creditAchieved, percentCreditAchieved } };
|
|
81182
|
-
}
|
|
81183
|
-
};
|
|
81184
|
-
stateVariableDefinitions.creditAchievedIfSubmit = {
|
|
81185
|
-
defaultValue: 0,
|
|
81186
|
-
stateVariablesDeterminingDependencies: [
|
|
81187
|
-
"aggregateScores",
|
|
81188
|
-
"scoredDescendants"
|
|
81189
|
-
],
|
|
81190
|
-
returnDependencies({ stateValues }) {
|
|
81191
|
-
let dependencies2 = {
|
|
81192
|
-
aggregateScores: {
|
|
81193
|
-
dependencyType: "stateVariable",
|
|
81194
|
-
variableName: "aggregateScores"
|
|
81195
|
-
}
|
|
81196
|
-
};
|
|
81197
|
-
if (stateValues.aggregateScores) {
|
|
81198
|
-
dependencies2.scoredDescendants = {
|
|
81199
|
-
dependencyType: "stateVariable",
|
|
81200
|
-
variableName: "scoredDescendants"
|
|
81201
|
-
};
|
|
81202
|
-
for (let [
|
|
81203
|
-
ind,
|
|
81204
|
-
descendant
|
|
81205
|
-
] of stateValues.scoredDescendants.entries()) {
|
|
81206
|
-
dependencies2["creditAchievedIfSubmit" + ind] = {
|
|
81207
|
-
dependencyType: "stateVariable",
|
|
81208
|
-
componentIdx: descendant.componentIdx,
|
|
81209
|
-
variableName: "creditAchievedIfSubmit"
|
|
81210
|
-
};
|
|
81211
|
-
}
|
|
81212
|
-
}
|
|
81213
|
-
return dependencies2;
|
|
81214
|
-
},
|
|
81215
|
-
definition({ dependencyValues }) {
|
|
81216
|
-
if (!dependencyValues.aggregateScores) {
|
|
81217
|
-
return {
|
|
81218
|
-
setValue: {
|
|
81219
|
-
creditAchievedIfSubmit: 0
|
|
81220
|
-
}
|
|
81221
|
-
};
|
|
81222
|
-
}
|
|
81223
|
-
let creditSum = 0;
|
|
81224
|
-
let totalWeight = 0;
|
|
81225
|
-
for (let [
|
|
81226
|
-
ind,
|
|
81227
|
-
component
|
|
81228
|
-
] of dependencyValues.scoredDescendants.entries()) {
|
|
81229
|
-
let weight = component.stateValues.weight;
|
|
81230
|
-
creditSum += dependencyValues["creditAchievedIfSubmit" + ind] * weight;
|
|
81231
|
-
totalWeight += weight;
|
|
81232
|
-
}
|
|
81233
|
-
let creditAchievedIfSubmit = creditSum / totalWeight;
|
|
81234
|
-
return { setValue: { creditAchievedIfSubmit } };
|
|
81235
|
-
}
|
|
81236
|
-
};
|
|
81237
81462
|
stateVariableDefinitions.generatedVariantInfo = {
|
|
81238
81463
|
shadowVariable: true,
|
|
81239
81464
|
additionalStateVariablesDefined: ["isVariantComponent"],
|
|
@@ -81358,76 +81583,6 @@ class SectioningComponent extends BlockComponent {
|
|
|
81358
81583
|
};
|
|
81359
81584
|
}
|
|
81360
81585
|
};
|
|
81361
|
-
stateVariableDefinitions.createSubmitAllButton = {
|
|
81362
|
-
forRenderer: true,
|
|
81363
|
-
additionalStateVariablesDefined: [
|
|
81364
|
-
{
|
|
81365
|
-
variableName: "suppressAnswerSubmitButtons",
|
|
81366
|
-
forRenderer: true
|
|
81367
|
-
}
|
|
81368
|
-
],
|
|
81369
|
-
returnDependencies: () => ({
|
|
81370
|
-
sectionWideCheckWork: {
|
|
81371
|
-
dependencyType: "stateVariable",
|
|
81372
|
-
variableName: "sectionWideCheckWork"
|
|
81373
|
-
},
|
|
81374
|
-
aggregateScores: {
|
|
81375
|
-
dependencyType: "stateVariable",
|
|
81376
|
-
variableName: "aggregateScores"
|
|
81377
|
-
},
|
|
81378
|
-
sectionAncestor: {
|
|
81379
|
-
dependencyType: "ancestor",
|
|
81380
|
-
componentType: "_sectioningComponent",
|
|
81381
|
-
variableNames: ["suppressAnswerSubmitButtons"]
|
|
81382
|
-
},
|
|
81383
|
-
documentAncestor: {
|
|
81384
|
-
dependencyType: "ancestor",
|
|
81385
|
-
componentType: "document",
|
|
81386
|
-
variableNames: ["suppressAnswerSubmitButtons"]
|
|
81387
|
-
}
|
|
81388
|
-
}),
|
|
81389
|
-
definition({ dependencyValues, componentIdx: componentIdx2 }) {
|
|
81390
|
-
let warnings = [];
|
|
81391
|
-
let createSubmitAllButton = false;
|
|
81392
|
-
let suppressAnswerSubmitButtons = false;
|
|
81393
|
-
if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons || dependencyValues.sectionAncestor && dependencyValues.sectionAncestor.stateValues.suppressAnswerSubmitButtons) {
|
|
81394
|
-
suppressAnswerSubmitButtons = true;
|
|
81395
|
-
} else if (dependencyValues.sectionWideCheckWork) {
|
|
81396
|
-
if (dependencyValues.aggregateScores) {
|
|
81397
|
-
createSubmitAllButton = true;
|
|
81398
|
-
suppressAnswerSubmitButtons = true;
|
|
81399
|
-
} else {
|
|
81400
|
-
warnings.push({
|
|
81401
|
-
message: `Cannot create submit all button for <section> because it doesn't aggregate scores.`,
|
|
81402
|
-
level: 1
|
|
81403
|
-
});
|
|
81404
|
-
}
|
|
81405
|
-
}
|
|
81406
|
-
return {
|
|
81407
|
-
setValue: {
|
|
81408
|
-
createSubmitAllButton,
|
|
81409
|
-
suppressAnswerSubmitButtons
|
|
81410
|
-
},
|
|
81411
|
-
sendWarnings: warnings
|
|
81412
|
-
};
|
|
81413
|
-
}
|
|
81414
|
-
};
|
|
81415
|
-
stateVariableDefinitions.suppressCheckWork = {
|
|
81416
|
-
forRenderer: true,
|
|
81417
|
-
returnDependencies: () => ({
|
|
81418
|
-
autoSubmit: {
|
|
81419
|
-
dependencyType: "flag",
|
|
81420
|
-
flagName: "autoSubmit"
|
|
81421
|
-
}
|
|
81422
|
-
}),
|
|
81423
|
-
definition({ dependencyValues }) {
|
|
81424
|
-
return {
|
|
81425
|
-
setValue: {
|
|
81426
|
-
suppressCheckWork: dependencyValues.autoSubmit
|
|
81427
|
-
}
|
|
81428
|
-
};
|
|
81429
|
-
}
|
|
81430
|
-
};
|
|
81431
81586
|
return stateVariableDefinitions;
|
|
81432
81587
|
}
|
|
81433
81588
|
async submitAllAnswers({
|
|
@@ -81435,33 +81590,12 @@ class SectioningComponent extends BlockComponent {
|
|
|
81435
81590
|
sourceInformation = {},
|
|
81436
81591
|
skipRendererUpdate = false
|
|
81437
81592
|
}) {
|
|
81438
|
-
|
|
81439
|
-
|
|
81440
|
-
|
|
81441
|
-
|
|
81442
|
-
|
|
81443
|
-
},
|
|
81444
|
-
result: {
|
|
81445
|
-
creditAchieved: await this.stateValues.creditAchievedIfSubmit
|
|
81446
|
-
}
|
|
81593
|
+
return submitAllAnswers({
|
|
81594
|
+
component: this,
|
|
81595
|
+
actionId,
|
|
81596
|
+
sourceInformation,
|
|
81597
|
+
skipRendererUpdate
|
|
81447
81598
|
});
|
|
81448
|
-
let numAnswers = await this.stateValues.answerDescendants;
|
|
81449
|
-
for (let [
|
|
81450
|
-
ind,
|
|
81451
|
-
answer
|
|
81452
|
-
] of await this.stateValues.answerDescendants.entries()) {
|
|
81453
|
-
if (!await answer.stateValues.justSubmitted) {
|
|
81454
|
-
await this.coreFunctions.performAction({
|
|
81455
|
-
componentIdx: answer.componentIdx,
|
|
81456
|
-
actionName: "submitAnswer",
|
|
81457
|
-
args: {
|
|
81458
|
-
actionId,
|
|
81459
|
-
sourceInformation,
|
|
81460
|
-
skipRendererUpdate: skipRendererUpdate || ind < numAnswers - 1
|
|
81461
|
-
}
|
|
81462
|
-
});
|
|
81463
|
-
}
|
|
81464
|
-
}
|
|
81465
81599
|
}
|
|
81466
81600
|
async revealSection({
|
|
81467
81601
|
actionId,
|
|
@@ -82193,6 +82327,7 @@ let Li$1 = class Li extends BaseComponent {
|
|
|
82193
82327
|
constructor(args) {
|
|
82194
82328
|
super(args);
|
|
82195
82329
|
Object.assign(this.actions, {
|
|
82330
|
+
submitAllAnswers: this.submitAllAnswers.bind(this),
|
|
82196
82331
|
recordVisibilityChange: this.recordVisibilityChange.bind(this)
|
|
82197
82332
|
});
|
|
82198
82333
|
}
|
|
@@ -82202,6 +82337,12 @@ let Li$1 = class Li extends BaseComponent {
|
|
|
82202
82337
|
static canDisplayChildErrors = true;
|
|
82203
82338
|
static inSchemaOnlyInheritAs = [];
|
|
82204
82339
|
static includeBlankStringChildren = true;
|
|
82340
|
+
static createAttributesObject() {
|
|
82341
|
+
let attributes = super.createAttributesObject();
|
|
82342
|
+
let scoredSectionAttributes = returnScoredSectionAttributes();
|
|
82343
|
+
Object.assign(attributes, scoredSectionAttributes);
|
|
82344
|
+
return attributes;
|
|
82345
|
+
}
|
|
82205
82346
|
static returnChildGroups() {
|
|
82206
82347
|
return [
|
|
82207
82348
|
{
|
|
@@ -82212,6 +82353,10 @@ let Li$1 = class Li extends BaseComponent {
|
|
|
82212
82353
|
}
|
|
82213
82354
|
static returnStateVariableDefinitions() {
|
|
82214
82355
|
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
82356
|
+
Object.assign(
|
|
82357
|
+
stateVariableDefinitions,
|
|
82358
|
+
returnScoredSectionStateVariableDefinition()
|
|
82359
|
+
);
|
|
82215
82360
|
stateVariableDefinitions.item = {
|
|
82216
82361
|
forRenderer: true,
|
|
82217
82362
|
returnDependencies: () => ({}),
|
|
@@ -82237,6 +82382,18 @@ let Li$1 = class Li extends BaseComponent {
|
|
|
82237
82382
|
};
|
|
82238
82383
|
return stateVariableDefinitions;
|
|
82239
82384
|
}
|
|
82385
|
+
async submitAllAnswers({
|
|
82386
|
+
actionId,
|
|
82387
|
+
sourceInformation = {},
|
|
82388
|
+
skipRendererUpdate = false
|
|
82389
|
+
}) {
|
|
82390
|
+
return submitAllAnswers({
|
|
82391
|
+
component: this,
|
|
82392
|
+
actionId,
|
|
82393
|
+
sourceInformation,
|
|
82394
|
+
skipRendererUpdate
|
|
82395
|
+
});
|
|
82396
|
+
}
|
|
82240
82397
|
recordVisibilityChange({ isVisible }) {
|
|
82241
82398
|
this.coreFunctions.requestRecordEvent({
|
|
82242
82399
|
verb: "visibilityChanged",
|
|
@@ -104024,6 +104181,7 @@ class Document extends BaseComponent {
|
|
|
104024
104181
|
stateVariableDefinitions,
|
|
104025
104182
|
returnScoredSectionStateVariableDefinition()
|
|
104026
104183
|
);
|
|
104184
|
+
delete stateVariableDefinitions.aggregateScores;
|
|
104027
104185
|
stateVariableDefinitions.titleChildName = {
|
|
104028
104186
|
forRenderer: true,
|
|
104029
104187
|
returnDependencies: () => ({
|
|
@@ -104468,22 +104626,6 @@ class Document extends BaseComponent {
|
|
|
104468
104626
|
};
|
|
104469
104627
|
}
|
|
104470
104628
|
};
|
|
104471
|
-
stateVariableDefinitions.suppressCheckWork = {
|
|
104472
|
-
forRenderer: true,
|
|
104473
|
-
returnDependencies: () => ({
|
|
104474
|
-
autoSubmit: {
|
|
104475
|
-
dependencyType: "flag",
|
|
104476
|
-
flagName: "autoSubmit"
|
|
104477
|
-
}
|
|
104478
|
-
}),
|
|
104479
|
-
definition({ dependencyValues }) {
|
|
104480
|
-
return {
|
|
104481
|
-
setValue: {
|
|
104482
|
-
suppressCheckWork: dependencyValues.autoSubmit
|
|
104483
|
-
}
|
|
104484
|
-
};
|
|
104485
|
-
}
|
|
104486
|
-
};
|
|
104487
104629
|
stateVariableDefinitions.containerTag = {
|
|
104488
104630
|
forRenderer: true,
|
|
104489
104631
|
returnDependencies: () => ({}),
|
|
@@ -104496,31 +104638,12 @@ class Document extends BaseComponent {
|
|
|
104496
104638
|
sourceInformation = {},
|
|
104497
104639
|
skipRendererUpdate = false
|
|
104498
104640
|
}) {
|
|
104499
|
-
|
|
104500
|
-
|
|
104501
|
-
|
|
104502
|
-
|
|
104503
|
-
|
|
104504
|
-
}
|
|
104641
|
+
return submitAllAnswers({
|
|
104642
|
+
component: this,
|
|
104643
|
+
actionId,
|
|
104644
|
+
sourceInformation,
|
|
104645
|
+
skipRendererUpdate
|
|
104505
104646
|
});
|
|
104506
|
-
let answersToSubmit = [];
|
|
104507
|
-
for (let answer of await this.stateValues.answerDescendants) {
|
|
104508
|
-
if (!await answer.stateValues.justSubmitted) {
|
|
104509
|
-
answersToSubmit.push(answer);
|
|
104510
|
-
}
|
|
104511
|
-
}
|
|
104512
|
-
let numAnswers = answersToSubmit.length;
|
|
104513
|
-
for (let [ind, answer] of answersToSubmit.entries()) {
|
|
104514
|
-
await this.coreFunctions.performAction({
|
|
104515
|
-
componentIdx: answer.componentIdx,
|
|
104516
|
-
actionName: "submitAnswer",
|
|
104517
|
-
args: {
|
|
104518
|
-
actionId,
|
|
104519
|
-
sourceInformation,
|
|
104520
|
-
skipRendererUpdate: skipRendererUpdate || ind < numAnswers - 1
|
|
104521
|
-
}
|
|
104522
|
-
});
|
|
104523
|
-
}
|
|
104524
104647
|
}
|
|
104525
104648
|
recordVisibilityChange({ isVisible }) {
|
|
104526
104649
|
this.coreFunctions.requestRecordEvent({
|
|
@@ -105806,6 +105929,7 @@ let P$2 = class P3 extends BlockComponent {
|
|
|
105806
105929
|
constructor(args) {
|
|
105807
105930
|
super(args);
|
|
105808
105931
|
Object.assign(this.actions, {
|
|
105932
|
+
submitAllAnswers: this.submitAllAnswers.bind(this),
|
|
105809
105933
|
recordVisibilityChange: this.recordVisibilityChange.bind(this)
|
|
105810
105934
|
});
|
|
105811
105935
|
}
|
|
@@ -105813,6 +105937,12 @@ let P$2 = class P3 extends BlockComponent {
|
|
|
105813
105937
|
static renderChildren = true;
|
|
105814
105938
|
static canDisplayChildErrors = true;
|
|
105815
105939
|
static includeBlankStringChildren = true;
|
|
105940
|
+
static createAttributesObject() {
|
|
105941
|
+
let attributes = super.createAttributesObject();
|
|
105942
|
+
let scoredSectionAttributes = returnScoredSectionAttributes();
|
|
105943
|
+
Object.assign(attributes, scoredSectionAttributes);
|
|
105944
|
+
return attributes;
|
|
105945
|
+
}
|
|
105816
105946
|
static returnChildGroups() {
|
|
105817
105947
|
return [
|
|
105818
105948
|
{
|
|
@@ -105827,6 +105957,10 @@ let P$2 = class P3 extends BlockComponent {
|
|
|
105827
105957
|
}
|
|
105828
105958
|
static returnStateVariableDefinitions() {
|
|
105829
105959
|
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
105960
|
+
Object.assign(
|
|
105961
|
+
stateVariableDefinitions,
|
|
105962
|
+
returnScoredSectionStateVariableDefinition()
|
|
105963
|
+
);
|
|
105830
105964
|
stateVariableDefinitions.text = {
|
|
105831
105965
|
public: true,
|
|
105832
105966
|
shadowingInstructions: {
|
|
@@ -105847,6 +105981,18 @@ let P$2 = class P3 extends BlockComponent {
|
|
|
105847
105981
|
};
|
|
105848
105982
|
return stateVariableDefinitions;
|
|
105849
105983
|
}
|
|
105984
|
+
async submitAllAnswers({
|
|
105985
|
+
actionId,
|
|
105986
|
+
sourceInformation = {},
|
|
105987
|
+
skipRendererUpdate = false
|
|
105988
|
+
}) {
|
|
105989
|
+
return submitAllAnswers({
|
|
105990
|
+
component: this,
|
|
105991
|
+
actionId,
|
|
105992
|
+
sourceInformation,
|
|
105993
|
+
skipRendererUpdate
|
|
105994
|
+
});
|
|
105995
|
+
}
|
|
105850
105996
|
recordVisibilityChange({ isVisible }) {
|
|
105851
105997
|
this.coreFunctions.requestRecordEvent({
|
|
105852
105998
|
verb: "visibilityChanged",
|
|
@@ -123611,10 +123757,16 @@ function returnStandardAnswerStateVariableDefinition() {
|
|
|
123611
123757
|
creditAchieved: {
|
|
123612
123758
|
dependencyType: "stateVariable",
|
|
123613
123759
|
variableName: "creditAchieved"
|
|
123760
|
+
},
|
|
123761
|
+
nextCreditFactor: {
|
|
123762
|
+
dependencyType: "stateVariable",
|
|
123763
|
+
variableName: "nextCreditFactor",
|
|
123764
|
+
variablesOptional: true
|
|
123614
123765
|
}
|
|
123615
123766
|
}),
|
|
123616
123767
|
definition({ dependencyValues }) {
|
|
123617
|
-
|
|
123768
|
+
const creditAchieved = dependencyValues.creditAchieved;
|
|
123769
|
+
if (creditAchieved === 1 || creditAchieved > 0 && creditAchieved === dependencyValues.nextCreditFactor) {
|
|
123618
123770
|
return {
|
|
123619
123771
|
setValue: { hasBeenCorrect: true },
|
|
123620
123772
|
setEssentialValue: { hasBeenCorrect: true }
|
|
@@ -124824,15 +124976,33 @@ class Answer extends InlineComponent {
|
|
|
124824
124976
|
dependencyType: "ancestor",
|
|
124825
124977
|
componentType: "document",
|
|
124826
124978
|
variableNames: ["suppressAnswerSubmitButtons"]
|
|
124979
|
+
},
|
|
124980
|
+
pAncestor: {
|
|
124981
|
+
dependencyType: "ancestor",
|
|
124982
|
+
componentType: "p",
|
|
124983
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
124984
|
+
},
|
|
124985
|
+
liAncestor: {
|
|
124986
|
+
dependencyType: "ancestor",
|
|
124987
|
+
componentType: "li",
|
|
124988
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
124989
|
+
},
|
|
124990
|
+
divAncestor: {
|
|
124991
|
+
dependencyType: "ancestor",
|
|
124992
|
+
componentType: "div",
|
|
124993
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
124994
|
+
},
|
|
124995
|
+
spanAncestor: {
|
|
124996
|
+
dependencyType: "ancestor",
|
|
124997
|
+
componentType: "span",
|
|
124998
|
+
variableNames: ["suppressAnswerSubmitButtons"]
|
|
124827
124999
|
}
|
|
124828
125000
|
}),
|
|
124829
125001
|
definition: function({ dependencyValues }) {
|
|
124830
125002
|
let delegateCheckWorkToAncestor = false;
|
|
124831
125003
|
let delegateCheckWorkToInput = false;
|
|
124832
125004
|
let delegateCheckWork = false;
|
|
124833
|
-
if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons) {
|
|
124834
|
-
delegateCheckWorkToAncestor = delegateCheckWork = true;
|
|
124835
|
-
} else if (dependencyValues.sectionAncestor?.stateValues.suppressAnswerSubmitButtons) {
|
|
125005
|
+
if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons || dependencyValues.sectionAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.pAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.liAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.divAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.spanAncestor?.stateValues.suppressAnswerSubmitButtons) {
|
|
124836
125006
|
delegateCheckWorkToAncestor = delegateCheckWork = true;
|
|
124837
125007
|
} else if (dependencyValues.inputChildren.length === 1 && !dependencyValues.forceFullCheckworkButton) {
|
|
124838
125008
|
delegateCheckWorkToInput = delegateCheckWork = true;
|
|
@@ -205530,14 +205700,16 @@ let PublicDoenetMLCore$1 = class PublicDoenetMLCore2 {
|
|
|
205530
205700
|
this.core?.handleNavigatingToComponent({ componentIdx: componentIdx2, hash });
|
|
205531
205701
|
}
|
|
205532
205702
|
/**
|
|
205533
|
-
* Call submitAnswer on all answers in the document
|
|
205703
|
+
* Call submitAnswer on all answers in the document,
|
|
205704
|
+
* then immediately save all document state to the database
|
|
205534
205705
|
*/
|
|
205535
205706
|
async submitAllAnswers() {
|
|
205536
|
-
|
|
205707
|
+
await this.core?.requestAction({
|
|
205537
205708
|
componentIdx: this.core.documentIdx,
|
|
205538
205709
|
actionName: "submitAllAnswers",
|
|
205539
205710
|
args: {}
|
|
205540
205711
|
});
|
|
205712
|
+
await this.core?.saveImmediately();
|
|
205541
205713
|
}
|
|
205542
205714
|
/**
|
|
205543
205715
|
* Immediately save all document state to the database,
|