@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.mjs
CHANGED
|
@@ -1035,15 +1035,26 @@ var getScore = withErrorHandler(_getScore, "getScore");
|
|
|
1035
1035
|
|
|
1036
1036
|
// src/domains/assignment/utils/calculateScoreAndProgress.ts
|
|
1037
1037
|
var calculateScoreAndProgress = (scores, cardsList, weights) => {
|
|
1038
|
+
const filteredScoreCards = Object.keys((scores == null ? void 0 : scores.cards) || {}).reduce(
|
|
1039
|
+
(acc, cardId) => {
|
|
1040
|
+
var _a;
|
|
1041
|
+
const cardScores = (_a = scores == null ? void 0 : scores.cards) == null ? void 0 : _a[cardId];
|
|
1042
|
+
if (cardScores && !cardScores.media_area_opened) {
|
|
1043
|
+
acc[cardId] = cardScores;
|
|
1044
|
+
}
|
|
1045
|
+
return acc;
|
|
1046
|
+
},
|
|
1047
|
+
{}
|
|
1048
|
+
);
|
|
1038
1049
|
const totalSetPoints = cardsList.reduce((acc, cardId) => {
|
|
1039
1050
|
acc += (weights == null ? void 0 : weights[cardId]) || 1;
|
|
1040
1051
|
return acc;
|
|
1041
1052
|
}, 0);
|
|
1042
|
-
const totalPointsAwarded = Object.keys(
|
|
1043
|
-
var _a
|
|
1044
|
-
const cardScores =
|
|
1053
|
+
const totalPointsAwarded = Object.keys(filteredScoreCards).reduce((acc, cardId) => {
|
|
1054
|
+
var _a;
|
|
1055
|
+
const cardScores = filteredScoreCards[cardId];
|
|
1045
1056
|
if ((cardScores == null ? void 0 : cardScores.completed) || (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0) {
|
|
1046
|
-
const score2 = (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0 ? Number((
|
|
1057
|
+
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;
|
|
1047
1058
|
const weight = (weights == null ? void 0 : weights[cardId]) || 1;
|
|
1048
1059
|
const fraction = (score2 != null ? score2 : 0) / 100;
|
|
1049
1060
|
if (score2 || score2 === 0) {
|
|
@@ -1054,9 +1065,8 @@ var calculateScoreAndProgress = (scores, cardsList, weights) => {
|
|
|
1054
1065
|
}
|
|
1055
1066
|
return acc;
|
|
1056
1067
|
}, 0);
|
|
1057
|
-
const totalCompletedCards = Object.keys(
|
|
1058
|
-
|
|
1059
|
-
const cardScores = (_a = scores == null ? void 0 : scores.cards) == null ? void 0 : _a[cardId];
|
|
1068
|
+
const totalCompletedCards = Object.keys(filteredScoreCards).reduce((acc, cardId) => {
|
|
1069
|
+
const cardScores = filteredScoreCards[cardId];
|
|
1060
1070
|
if ((cardScores == null ? void 0 : cardScores.completed) || (cardScores == null ? void 0 : cardScores.score) || (cardScores == null ? void 0 : cardScores.score) === 0) {
|
|
1061
1071
|
acc += 1;
|
|
1062
1072
|
}
|
|
@@ -2443,6 +2453,10 @@ function useActivity({
|
|
|
2443
2453
|
enabled: querySet.isSuccess,
|
|
2444
2454
|
asObject: true
|
|
2445
2455
|
});
|
|
2456
|
+
const scorableCardIds = (contentCardsToUse != null ? contentCardsToUse : []).filter((cardId) => {
|
|
2457
|
+
const card = cardsObject == null ? void 0 : cardsObject[cardId];
|
|
2458
|
+
return (card == null ? void 0 : card.type) !== "MEDIA_PAGE" /* MEDIA_PAGE */;
|
|
2459
|
+
});
|
|
2446
2460
|
const scoreQuery = useScore({
|
|
2447
2461
|
isAssignment,
|
|
2448
2462
|
activityId: id,
|
|
@@ -2456,7 +2470,7 @@ function useActivity({
|
|
|
2456
2470
|
activityId,
|
|
2457
2471
|
isAssignment,
|
|
2458
2472
|
userId,
|
|
2459
|
-
cardIds:
|
|
2473
|
+
cardIds: scorableCardIds,
|
|
2460
2474
|
weights: weightsToUse != null ? weightsToUse : {}
|
|
2461
2475
|
});
|
|
2462
2476
|
const { mutationClearScore } = useClearScore();
|
|
@@ -2526,7 +2540,7 @@ function useActivity({
|
|
|
2526
2540
|
maxPoints: (_n = (_m = assignmentQuery.data) == null ? void 0 : _m.maxPoints) != null ? _n : 0
|
|
2527
2541
|
},
|
|
2528
2542
|
userId,
|
|
2529
|
-
cardIds:
|
|
2543
|
+
cardIds: scorableCardIds,
|
|
2530
2544
|
scores: scoreQuery.data,
|
|
2531
2545
|
weights: weightsToUse != null ? weightsToUse : {},
|
|
2532
2546
|
status: someCardIsManualGraded ? "PENDING_REVIEW" : "SUBMITTED"
|