@doenet/v06-to-v07 0.7.0-beta5 → 0.7.0-beta6

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.
Files changed (3) hide show
  1. package/index.js +33 -20
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -80628,9 +80628,8 @@ class SectioningComponent extends BlockComponent {
80628
80628
  let attributes = super.createAttributesObject();
80629
80629
  attributes.aggregateScores = {
80630
80630
  createComponentOfType: "boolean",
80631
- createStateVariable: "aggregateScores",
80632
- defaultValue: false,
80633
- public: true
80631
+ createStateVariable: "aggregateScoresPreliminary",
80632
+ defaultValue: false
80634
80633
  };
80635
80634
  attributes.weight = {
80636
80635
  createComponentOfType: "number",
@@ -81088,6 +81087,29 @@ class SectioningComponent extends BlockComponent {
81088
81087
  return { setValue: { level } };
81089
81088
  }
81090
81089
  };
81090
+ stateVariableDefinitions.aggregateScores = {
81091
+ public: true,
81092
+ shadowingInstructions: {
81093
+ createComponentOfType: "boolean"
81094
+ },
81095
+ returnDependencies: () => ({
81096
+ aggregateScoresPreliminary: {
81097
+ dependencyType: "stateVariable",
81098
+ variableName: "aggregateScoresPreliminary"
81099
+ },
81100
+ sectionWideCheckWork: {
81101
+ dependencyType: "stateVariable",
81102
+ variableName: "sectionWideCheckWork"
81103
+ }
81104
+ }),
81105
+ definition({ dependencyValues }) {
81106
+ return {
81107
+ setValue: {
81108
+ aggregateScores: dependencyValues.aggregateScoresPreliminary || dependencyValues.sectionWideCheckWork
81109
+ }
81110
+ };
81111
+ }
81112
+ };
81091
81113
  stateVariableDefinitions.creditAchieved = {
81092
81114
  public: true,
81093
81115
  shadowingInstructions: {
@@ -81371,10 +81393,6 @@ class SectioningComponent extends BlockComponent {
81371
81393
  dependencyType: "stateVariable",
81372
81394
  variableName: "sectionWideCheckWork"
81373
81395
  },
81374
- aggregateScores: {
81375
- dependencyType: "stateVariable",
81376
- variableName: "aggregateScores"
81377
- },
81378
81396
  sectionAncestor: {
81379
81397
  dependencyType: "ancestor",
81380
81398
  componentType: "_sectioningComponent",
@@ -81386,22 +81404,15 @@ class SectioningComponent extends BlockComponent {
81386
81404
  variableNames: ["suppressAnswerSubmitButtons"]
81387
81405
  }
81388
81406
  }),
81389
- definition({ dependencyValues, componentIdx: componentIdx2 }) {
81407
+ definition({ dependencyValues }) {
81390
81408
  let warnings = [];
81391
81409
  let createSubmitAllButton = false;
81392
81410
  let suppressAnswerSubmitButtons = false;
81393
81411
  if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons || dependencyValues.sectionAncestor && dependencyValues.sectionAncestor.stateValues.suppressAnswerSubmitButtons) {
81394
81412
  suppressAnswerSubmitButtons = true;
81395
81413
  } 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
- }
81414
+ createSubmitAllButton = true;
81415
+ suppressAnswerSubmitButtons = true;
81405
81416
  }
81406
81417
  return {
81407
81418
  setValue: {
@@ -123259,7 +123270,7 @@ function returnStandardAnswerAttributes() {
123259
123270
  disableAfterCorrect: {
123260
123271
  createComponentOfType: "boolean",
123261
123272
  createStateVariable: "disableAfterCorrect",
123262
- defaultValue: false,
123273
+ defaultValue: true,
123263
123274
  public: true
123264
123275
  },
123265
123276
  submitLabel: {
@@ -205530,14 +205541,16 @@ let PublicDoenetMLCore$1 = class PublicDoenetMLCore2 {
205530
205541
  this.core?.handleNavigatingToComponent({ componentIdx: componentIdx2, hash });
205531
205542
  }
205532
205543
  /**
205533
- * Call submitAnswer on all answers in the document
205544
+ * Call submitAnswer on all answers in the document,
205545
+ * then immediately save all document state to the database
205534
205546
  */
205535
205547
  async submitAllAnswers() {
205536
- return await this.core?.requestAction({
205548
+ await this.core?.requestAction({
205537
205549
  componentIdx: this.core.documentIdx,
205538
205550
  actionName: "submitAllAnswers",
205539
205551
  args: {}
205540
205552
  });
205553
+ await this.core?.saveImmediately();
205541
205554
  }
205542
205555
  /**
205543
205556
  * Immediately save all document state to the database,