@shaxpir/duiduidui-models 1.4.28 → 1.4.29

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.
@@ -28,6 +28,7 @@ export declare class Progress extends Content {
28
28
  static create(userId: ContentId): Progress;
29
29
  constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
30
30
  get payload(): ProgressPayload;
31
+ getSkillLevel(): UncertainValue;
31
32
  getSkillLevelValue(): number;
32
33
  getSkillLevelUncertainty(): number;
33
34
  getSkillLevelLowerBound(): number;
@@ -35,6 +36,7 @@ export declare class Progress extends Content {
35
36
  needsCalibration(): boolean;
36
37
  getCognitiveLoad(): number;
37
38
  getPhrases(): Record<string, PhraseProgress>;
39
+ setSkillLevel(uncertainValue: UncertainValue): void;
38
40
  setSkillLevelValue(value: number): void;
39
41
  setSkillLevelUncertainty(uncertainty: number): void;
40
42
  setSkillLevelLowerBound(lowerBound: number): void;
@@ -43,6 +43,10 @@ class Progress extends Content_1.Content {
43
43
  this.checkDisposed("Progress.payload");
44
44
  return this.doc.data.payload;
45
45
  }
46
+ getSkillLevel() {
47
+ this.checkDisposed("Progress.getSkillLevel");
48
+ return shaxpir_common_1.Struct.clone(this.payload.skill_level);
49
+ }
46
50
  getSkillLevelValue() {
47
51
  this.checkDisposed("Progress.getSkillLevelValue");
48
52
  return this.payload.skill_level.value;
@@ -72,6 +76,17 @@ class Progress extends Content_1.Content {
72
76
  this.checkDisposed("Progress.getPhrases");
73
77
  return this.payload.phrases;
74
78
  }
79
+ setSkillLevel(uncertainValue) {
80
+ this.checkDisposed("Progress.setSkillLevel");
81
+ if (!shaxpir_common_1.Struct.equals(this.payload.skill_level, uncertainValue)) {
82
+ const batch = new Operation_1.BatchOperation(this);
83
+ batch.setPathValue(['payload', 'skill_level', 'value'], uncertainValue.value);
84
+ batch.setPathValue(['payload', 'skill_level', 'uncertainty'], uncertainValue.uncertainty);
85
+ batch.setPathValue(['payload', 'skill_level', 'bounds', 'lower'], uncertainValue.bounds.lower);
86
+ batch.setPathValue(['payload', 'skill_level', 'bounds', 'upper'], uncertainValue.bounds.upper);
87
+ batch.commit();
88
+ }
89
+ }
75
90
  setSkillLevelValue(value) {
76
91
  this.checkDisposed("Progress.setSkillLevelValue");
77
92
  if (this.payload.skill_level.value !== value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.4.28",
3
+ "version": "1.4.29",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"