math-exercises 3.0.132 → 3.0.134

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 (87) hide show
  1. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +1 -1
  2. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +5 -5
  4. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/ordering/compareA10N.js +12 -7
  6. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
  8. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -1
  9. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +4 -0
  10. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
  11. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
  12. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
  14. package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
  15. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
  16. package/lib/exercises/math/conversion/prefixToNumber.js +27 -22
  17. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +1 -2
  19. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +4 -1
  20. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +29 -9
  22. package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
  23. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/cartesian/index.js +1 -0
  25. package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
  26. package/lib/exercises/math/geometry/cartesian/midpoint.js +8 -1
  27. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
  28. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  29. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
  30. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
  31. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
  32. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
  33. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
  34. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +6 -6
  35. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +0 -1
  36. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
  37. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +52 -59
  38. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
  39. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
  40. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts +8 -0
  41. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
  42. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.js +105 -0
  43. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts +9 -0
  44. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts.map +1 -0
  45. package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.js +99 -0
  46. package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
  47. package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +9 -1
  48. package/lib/exercises/math/sequences/arithmetic/index.d.ts +2 -0
  49. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  50. package/lib/exercises/math/sequences/arithmetic/index.js +2 -0
  51. package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
  52. package/lib/exercises/math/sequences/genericSequenceVariations.js +5 -1
  53. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
  54. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +7 -1
  55. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  56. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +1 -1
  57. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts +8 -0
  58. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
  59. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +112 -0
  60. package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts +9 -0
  61. package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts.map +1 -0
  62. package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.js +97 -0
  63. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  64. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +3 -1
  65. package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
  66. package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.js +9 -1
  67. package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
  68. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  69. package/lib/exercises/math/sequences/geometric/index.js +2 -0
  70. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
  71. package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +10 -3
  72. package/lib/exercises/pc/index.d.ts +0 -1
  73. package/lib/exercises/pc/index.d.ts.map +1 -1
  74. package/lib/exercises/pc/index.js +0 -1
  75. package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
  76. package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
  77. package/lib/exercises/pc/motion/averageSpeed.js +28 -36
  78. package/lib/exercises/pc/weight/calculateWeight.d.ts +0 -1
  79. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  80. package/lib/exercises/pc/weight/calculateWeight.js +26 -19
  81. package/lib/index.d.ts +26 -39
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/playgroundUtils.d.ts +3 -0
  84. package/lib/playgroundUtils.d.ts.map +1 -0
  85. package/lib/playgroundUtils.js +13 -0
  86. package/lib/server.js +126 -0
  87. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -159,7 +159,7 @@ declare const mathExercises: (Exercise<{
159
159
  nodeIdsStartingNumber: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
160
160
  progCalcIds: import("./math/progCalc/progCalc.js").ProgCalcIdentifiers;
161
161
  }, {
162
- numberType: "Integer" | "Decimal";
162
+ numberType: "Entier" | "D\u00E9cimal";
163
163
  nbSteps: string;
164
164
  nbDigits: string;
165
165
  }> | Exercise<{
@@ -740,8 +740,6 @@ declare const mathExercises: (Exercise<{
740
740
  }, Record<string, string | boolean | string[]>> | Exercise<{
741
741
  prefixIndexesPool: number[];
742
742
  prefixIndex: number;
743
- isToPow10: boolean;
744
- isFromSymbol: boolean;
745
743
  }, {
746
744
  prefixPool: string[];
747
745
  isToPow10: boolean;
@@ -1199,7 +1197,9 @@ declare const mathExercises: (Exercise<{
1199
1197
  a: number;
1200
1198
  b: number;
1201
1199
  c: number;
1202
- }, Record<string, string | boolean | string[]>> | Exercise<{
1200
+ }, {
1201
+ withNoCoeffB: boolean;
1202
+ }> | Exercise<{
1203
1203
  trinomIdentifiers: import("./tree/nodes/polynomials/trinomNode.js").TrinomNodeIdentifiers;
1204
1204
  }, Record<string, string | boolean | string[]>> | Exercise<{
1205
1205
  trinomCoeffs: number[];
@@ -1554,6 +1554,13 @@ declare const mathExercises: (Exercise<{
1554
1554
  absciss: number;
1555
1555
  abscissTex: string;
1556
1556
  coeff: number;
1557
+ }, Record<string, string | boolean | string[]>> | Exercise<{
1558
+ abscissType: import("./math/numbers/nombre.js").NumberType;
1559
+ axisUnit: number;
1560
+ oneUnitTex: string;
1561
+ absciss: number;
1562
+ abscissTex: string;
1563
+ coeff: number;
1557
1564
  }, Record<string, string | boolean | string[]>> | Exercise<{
1558
1565
  abscissType: import("./math/numbers/nombre.js").NumberType;
1559
1566
  axisUnit: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
@@ -2476,7 +2483,6 @@ declare const mathExercises: (Exercise<{
2476
2483
  }, {
2477
2484
  nbElem: string[];
2478
2485
  unionLength: string[];
2479
- isProbasAreNumbers: boolean;
2480
2486
  }> | Exercise<{
2481
2487
  situationIndex: number;
2482
2488
  dictShuffle: Record<string, string>;
@@ -2488,6 +2494,9 @@ declare const mathExercises: (Exercise<{
2488
2494
  }, Record<string, string | boolean | string[]>> | Exercise<{
2489
2495
  firstValue: number;
2490
2496
  reason: number;
2497
+ }, Record<string, string | boolean | string[]>> | Exercise<{
2498
+ firstValue: number;
2499
+ reason: number;
2491
2500
  }, Record<string, string | boolean | string[]>> | Exercise<{
2492
2501
  rank1: number;
2493
2502
  reason: number;
@@ -2543,6 +2552,10 @@ declare const mathExercises: (Exercise<{
2543
2552
  firstTerm: number;
2544
2553
  reason: number;
2545
2554
  askedRank: number;
2555
+ }, Record<string, string | boolean | string[]>> | Exercise<{
2556
+ firstTerm: number;
2557
+ reason: number;
2558
+ askedRank: number;
2546
2559
  }, Record<string, string | boolean | string[]>> | Exercise<{
2547
2560
  a: number;
2548
2561
  b: number;
@@ -2554,6 +2567,9 @@ declare const mathExercises: (Exercise<{
2554
2567
  }, Record<string, string | boolean | string[]>> | Exercise<{
2555
2568
  reason: number;
2556
2569
  firstValue: number;
2570
+ }, Record<string, string | boolean | string[]>> | Exercise<{
2571
+ reason: number;
2572
+ firstValue: number;
2557
2573
  }, Record<string, string | boolean | string[]>> | Exercise<{
2558
2574
  value1: number;
2559
2575
  reason: number;
@@ -2579,6 +2595,10 @@ declare const mathExercises: (Exercise<{
2579
2595
  firstTerm: number;
2580
2596
  reason: number;
2581
2597
  askedRank: number;
2598
+ }, Record<string, string | boolean | string[]>> | Exercise<{
2599
+ firstTerm: number;
2600
+ reason: number;
2601
+ askedRank: number;
2582
2602
  }, Record<string, string | boolean | string[]>> | Exercise<{
2583
2603
  sequence: number[];
2584
2604
  reason: number;
@@ -3248,12 +3268,7 @@ declare const mathExercises: (Exercise<{
3248
3268
  value: number;
3249
3269
  unitIndex: number;
3250
3270
  };
3251
- opts: {
3252
- acceptedInputType: string;
3253
- unitTex: string;
3254
- };
3255
3271
  }, {
3256
- acceptedInputType: string;
3257
3272
  unitTex: string;
3258
3273
  }> | Exercise<{
3259
3274
  speed: number;
@@ -3309,10 +3324,6 @@ declare const mathExercises: (Exercise<{
3309
3324
  T: number;
3310
3325
  }, Record<string, string | boolean | string[]>> | Exercise<{
3311
3326
  mass: number;
3312
- optsIdent: {
3313
- inputType: "decimal" | "sci";
3314
- nbDigits: string;
3315
- };
3316
3327
  }, {
3317
3328
  inputType: "decimal" | "sci";
3318
3329
  nbDigits: string;
@@ -3722,12 +3733,7 @@ declare const pcExercises: (Exercise<{
3722
3733
  value: number;
3723
3734
  unitIndex: number;
3724
3735
  };
3725
- opts: {
3726
- acceptedInputType: string;
3727
- unitTex: string;
3728
- };
3729
3736
  }, {
3730
- acceptedInputType: string;
3731
3737
  unitTex: string;
3732
3738
  }> | Exercise<{
3733
3739
  speed: number;
@@ -3783,10 +3789,6 @@ declare const pcExercises: (Exercise<{
3783
3789
  T: number;
3784
3790
  }, Record<string, string | boolean | string[]>> | Exercise<{
3785
3791
  mass: number;
3786
- optsIdent: {
3787
- inputType: "decimal" | "sci";
3788
- nbDigits: string;
3789
- };
3790
3792
  }, {
3791
3793
  inputType: "decimal" | "sci";
3792
3794
  nbDigits: string;
@@ -3803,21 +3805,6 @@ declare const pcExercises: (Exercise<{
3803
3805
  }, Record<string, string | boolean | string[]>> | Exercise<{
3804
3806
  E: number[];
3805
3807
  S: number[];
3806
- }, Record<string, string | boolean | string[]>> | Exercise<{
3807
- OFPrime: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
3808
- OA: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
3809
- OAPrime: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
3810
- opts: {
3811
- typeDistance: "distance focale" | "distance image" | "distance objet";
3812
- typeImage: "réelle finie" | "réelle infinie" | "imaginaire finie" | "imaginaire infinie";
3813
- unit: "cm" | "m";
3814
- roundTo: string;
3815
- };
3816
- }, {
3817
- typeDistance: "distance focale" | "distance image" | "distance objet";
3818
- typeImage: "réelle finie" | "réelle infinie" | "imaginaire finie" | "imaginaire infinie";
3819
- unit: "cm" | "m";
3820
- roundTo: string;
3821
- }>)[];
3808
+ }, Record<string, string | boolean | string[]>>)[];
3822
3809
  export { mathExercises, pcExercises, Exercise, Question, parseAlgebraic };
3823
3810
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const viewerUrlExample: () => string;
2
+ export declare const getViewerURLForGetQuestionFromIdentifiers: (exoId: string, identifiers: object, options?: Record<string, string | string[] | boolean>) => string;
3
+ //# sourceMappingURL=playgroundUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playgroundUtils.d.ts","sourceRoot":"","sources":["../src/playgroundUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cAQ5B,CAAC;AAEF,eAAO,MAAM,yCAAyC,GACpD,OAAO,MAAM,EACb,aAAa,MAAM,EACnB,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,WAKtD,CAAC"}
@@ -0,0 +1,13 @@
1
+ export const viewerUrlExample = () => {
2
+ const exoId = "primeNumbers";
3
+ const identifiers = {
4
+ nb: 20,
5
+ };
6
+ const options = {};
7
+ return getViewerURLForGetQuestionFromIdentifiers(exoId, identifiers, options);
8
+ };
9
+ export const getViewerURLForGetQuestionFromIdentifiers = (exoId, identifiers, options) => {
10
+ const exoIdentifiers = JSON.stringify(identifiers);
11
+ const exoOptions = JSON.stringify(options);
12
+ return `http://localhost:5173/exo?exoId=${exoId}&identifiers=${exoIdentifiers}&options=${exoOptions}`;
13
+ };
package/lib/server.js CHANGED
@@ -41,6 +41,132 @@ const runServer = () => {
41
41
  app.get("/xplive", (_req, res) => {
42
42
  res.json(pcExercises);
43
43
  });
44
+ app.get("/generator", (req, res) => {
45
+ const n = Number(req.query.n);
46
+ const exoId = req.query.exoId;
47
+ const options = req.query.options
48
+ ? JSON.parse(req.query.options)
49
+ : undefined;
50
+ const exo = allExercises.find((exo) => exo.id == exoId);
51
+ if (!exo) {
52
+ res.send("Exo not found");
53
+ return;
54
+ }
55
+ const questions = exo?.generator(n, options);
56
+ res.json(questions);
57
+ });
58
+ app.get("/getQuestionFromIdentifiers", (req, res) => {
59
+ const exoId = req.query.exoId;
60
+ const exo = allExercises.find((exo) => exo.id == exoId);
61
+ if (!exo) {
62
+ res.send("Exo not found");
63
+ return;
64
+ }
65
+ const identifiers = req.query.identifiers
66
+ ? JSON.parse(req.query.identifiers)
67
+ : undefined;
68
+ const options = req.query.options
69
+ ? JSON.parse(req.query.options)
70
+ : undefined;
71
+ const question = exo?.getQuestionFromIdentifiers(identifiers, options);
72
+ res.json({
73
+ exercise: exo,
74
+ question,
75
+ });
76
+ });
77
+ app.get("/getPropositions", (req, res) => {
78
+ const n = Number(req.query.n) || 4;
79
+ const exoId = req.query.exoId;
80
+ const options = req.query.options
81
+ ? JSON.parse(req.query.options)
82
+ : undefined;
83
+ const identifiers = req.query.identifiers
84
+ ? JSON.parse(req.query.identifiers)
85
+ : undefined;
86
+ console.log("raw", req.query.answer);
87
+ console.log("dec", decodeURI(req.query.answer));
88
+ const answer = JSON.parse(decodeURI(req.query.answer));
89
+ const exo = allExercises.find((exo) => exo.id == exoId);
90
+ console.log("ans", answer);
91
+ if (!exo) {
92
+ res.send("Exo not found");
93
+ return;
94
+ }
95
+ if (!exo?.getPropositions) {
96
+ res.send("no getPropositions");
97
+ return;
98
+ }
99
+ const props = exo.getPropositions(n, { answer: exo.getAnswer?.(identifiers, options) ?? "", ...identifiers }, options);
100
+ res.json(props);
101
+ });
102
+ app.get("/isAnswerTableValid", (req, res) => {
103
+ const exoId = req.query.exoId;
104
+ const options = req.query.options
105
+ ? JSON.parse(req.query.options)
106
+ : undefined;
107
+ const identifiers = req.query.identifiers
108
+ ? JSON.parse(req.query.identifiers)
109
+ : undefined;
110
+ const studentAnswer = JSON.parse(req.query.studentAnswer);
111
+ const answerTable = JSON.parse(req.query.answerTable);
112
+ const exo = allExercises.find((exo) => exo.id == exoId);
113
+ if (!exo) {
114
+ res.send("Exo not found");
115
+ return;
116
+ }
117
+ if (!exo?.isAnswerTableValid) {
118
+ res.send("no isAnswerTableValid");
119
+ return;
120
+ }
121
+ const valid = exo.isAnswerTableValid(studentAnswer, { answerTable, ...identifiers }, options);
122
+ res.json(valid);
123
+ });
124
+ app.get("/isAnswerValid", (req, res) => {
125
+ const exoId = req.query.exoId;
126
+ const options = req.query.options
127
+ ? JSON.parse(req.query.options)
128
+ : undefined;
129
+ const identifiers = req.query.identifiers
130
+ ? JSON.parse(req.query.identifiers)
131
+ : undefined;
132
+ const studentAnswer = JSON.parse(req.query.studentAnswer);
133
+ const answer = JSON.parse(req.query.answer);
134
+ const exo = allExercises.find((exo) => exo.id == exoId);
135
+ if (!exo) {
136
+ res.send("Exo not found");
137
+ return;
138
+ }
139
+ if (!exo?.isAnswerValid) {
140
+ res.send("no isAnswerValid");
141
+ return;
142
+ }
143
+ console.log("there");
144
+ const valid = exo.isAnswerValid(studentAnswer, { answer, ...identifiers }, options);
145
+ console.log(valid);
146
+ res.json(valid);
147
+ });
148
+ app.get("/isGGBAnswerValid", (req, res) => {
149
+ const exoId = req.query.exoId;
150
+ const options = req.query.options
151
+ ? JSON.parse(req.query.options)
152
+ : undefined;
153
+ const identifiers = req.query.identifiers
154
+ ? JSON.parse(req.query.identifiers)
155
+ : undefined;
156
+ const studentAnswer = JSON.parse(req.query.studentAnswer);
157
+ const ggbAnswer = JSON.parse(req.query.ggbAnswer);
158
+ const exo = allExercises.find((exo) => exo.id == exoId);
159
+ if (!exo) {
160
+ res.send("Exo not found");
161
+ return;
162
+ }
163
+ if (!exo?.isGGBAnswerValid) {
164
+ res.send("no isGGBAnswerValid");
165
+ return;
166
+ }
167
+ const valid = exo.isGGBAnswerValid(studentAnswer, { ggbAnswer, ...identifiers }, options);
168
+ res.json(valid);
169
+ });
44
170
  app.get("/question", (req, res) => {
45
171
  const exoId = req.query.exoId;
46
172
  const options = req.query.options
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.132",
4
+ "version": "3.0.134",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [