@speakableio/core 1.0.15 → 1.0.17
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/dist/index.native.js +23 -9
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +23 -9
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.js +23 -9
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.native.js
CHANGED
|
@@ -1141,15 +1141,26 @@ var getScore = withErrorHandler(_getScore, "getScore");
|
|
|
1141
1141
|
|
|
1142
1142
|
// src/domains/assignment/utils/calculateScoreAndProgress.ts
|
|
1143
1143
|
var calculateScoreAndProgress = (scores, cardsList, weights) => {
|
|
1144
|
+
const filteredScoreCards = Object.keys((scores == null ? void 0 : scores.cards) || {}).reduce(
|
|
1145
|
+
(acc, cardId) => {
|
|
1146
|
+
var _a;
|
|
1147
|
+
const cardScores = (_a = scores == null ? void 0 : scores.cards) == null ? void 0 : _a[cardId];
|
|
1148
|
+
if (cardScores && !cardScores.media_area_opened) {
|
|
1149
|
+
acc[cardId] = cardScores;
|
|
1150
|
+
}
|
|
1151
|
+
return acc;
|
|
1152
|
+
},
|
|
1153
|
+
{}
|
|
1154
|
+
);
|
|
1144
1155
|
const totalSetPoints = cardsList.reduce((acc, cardId) => {
|
|
1145
1156
|
acc += (weights == null ? void 0 : weights[cardId]) || 1;
|
|
1146
1157
|
return acc;
|
|
1147
1158
|
}, 0);
|
|
1148
|
-
const totalPointsAwarded = Object.keys(
|
|
1149
|
-
var _a
|
|
1150
|
-
const cardScores =
|
|
1159
|
+
const totalPointsAwarded = Object.keys(filteredScoreCards).reduce((acc, cardId) => {
|
|
1160
|
+
var _a;
|
|
1161
|
+
const cardScores = filteredScoreCards[cardId];
|
|
1151
1162
|
if ((cardScores == null ? void 0 : cardScores.completed) || (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0) {
|
|
1152
|
-
const score2 = (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0 ? Number((
|
|
1163
|
+
const score2 = (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0 ? Number((_a = cardScores == null ? void 0 : cardScores.score) != null ? _a : 0) : null;
|
|
1153
1164
|
const weight = (weights == null ? void 0 : weights[cardId]) || 1;
|
|
1154
1165
|
const fraction = (score2 != null ? score2 : 0) / 100;
|
|
1155
1166
|
if (score2 || score2 === 0) {
|
|
@@ -1160,9 +1171,8 @@ var calculateScoreAndProgress = (scores, cardsList, weights) => {
|
|
|
1160
1171
|
}
|
|
1161
1172
|
return acc;
|
|
1162
1173
|
}, 0);
|
|
1163
|
-
const totalCompletedCards = Object.keys(
|
|
1164
|
-
|
|
1165
|
-
const cardScores = (_a = scores == null ? void 0 : scores.cards) == null ? void 0 : _a[cardId];
|
|
1174
|
+
const totalCompletedCards = Object.keys(filteredScoreCards).reduce((acc, cardId) => {
|
|
1175
|
+
const cardScores = filteredScoreCards[cardId];
|
|
1166
1176
|
if ((cardScores == null ? void 0 : cardScores.completed) || (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0) {
|
|
1167
1177
|
acc += 1;
|
|
1168
1178
|
}
|
|
@@ -2549,6 +2559,10 @@ function useActivity({
|
|
|
2549
2559
|
enabled: querySet.isSuccess,
|
|
2550
2560
|
asObject: true
|
|
2551
2561
|
});
|
|
2562
|
+
const scorableCardIds = (contentCardsToUse != null ? contentCardsToUse : []).filter((cardId) => {
|
|
2563
|
+
const card = cardsObject == null ? void 0 : cardsObject[cardId];
|
|
2564
|
+
return (card == null ? void 0 : card.type) !== "MEDIA_PAGE" /* MEDIA_PAGE */;
|
|
2565
|
+
});
|
|
2552
2566
|
const scoreQuery = useScore({
|
|
2553
2567
|
isAssignment,
|
|
2554
2568
|
activityId: id,
|
|
@@ -2562,7 +2576,7 @@ function useActivity({
|
|
|
2562
2576
|
activityId,
|
|
2563
2577
|
isAssignment,
|
|
2564
2578
|
userId,
|
|
2565
|
-
cardIds:
|
|
2579
|
+
cardIds: scorableCardIds,
|
|
2566
2580
|
weights: weightsToUse != null ? weightsToUse : {}
|
|
2567
2581
|
});
|
|
2568
2582
|
const { mutationClearScore } = useClearScore();
|
|
@@ -2632,7 +2646,7 @@ function useActivity({
|
|
|
2632
2646
|
maxPoints: (_n = (_m = assignmentQuery.data) == null ? void 0 : _m.maxPoints) != null ? _n : 0
|
|
2633
2647
|
},
|
|
2634
2648
|
userId,
|
|
2635
|
-
cardIds:
|
|
2649
|
+
cardIds: scorableCardIds,
|
|
2636
2650
|
scores: scoreQuery.data,
|
|
2637
2651
|
weights: weightsToUse != null ? weightsToUse : {},
|
|
2638
2652
|
status: someCardIsManualGraded ? "PENDING_REVIEW" : "SUBMITTED"
|