@instructure/quiz-core 20.30.0 → 20.30.1-snapshot.0
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/CHANGELOG.md +4705 -0
- package/es/common/selectors/interactionTypes.js +26 -14
- package/es/common/selectors/quizzes.js +45 -29
- package/es/common/selectors/sessionItemResults.js +15 -5
- package/es/common/selectors/sessionItems.js +19 -9
- package/lib/common/selectors/interactionTypes.js +26 -14
- package/lib/common/selectors/quizzes.js +45 -29
- package/lib/common/selectors/sessionItemResults.js +15 -5
- package/lib/common/selectors/sessionItems.js +19 -9
- package/package.json +13 -11
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
1
3
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
2
|
-
var _dec,
|
|
4
|
+
var _dec, _class;
|
|
3
5
|
// TODO: Use more reselect! Create a getInteractionTypes selector that can be used for reselecting interaction types by
|
|
4
6
|
// id(s)
|
|
5
7
|
import { Map } from 'immutable';
|
|
@@ -13,21 +15,31 @@ export var getInteractionType = function getInteractionType(state, id) {
|
|
|
13
15
|
var IntTypeRecord = interactionTypeRecordForItem(slug);
|
|
14
16
|
return new IntTypeRecord(interactionTypeData);
|
|
15
17
|
};
|
|
16
|
-
var
|
|
18
|
+
var CacheHelper = (_dec = withStateCache(function () {
|
|
17
19
|
return [['interactionTypes']];
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return reduxStore.getAppState();
|
|
22
|
-
},
|
|
23
|
-
interactionTypes: function interactionTypes(state) {
|
|
24
|
-
return state.get('interactionTypes', Map()).filter(function (intTypeData) {
|
|
25
|
-
return featureOn('interaction_type_rich_fill_blank') ? intTypeData.get('slug') !== 'fill-blank' : intTypeData.get('slug') !== 'rich-fill-blank';
|
|
26
|
-
}).map(function (intTypeData) {
|
|
27
|
-
return getInteractionType(state, intTypeData.get('id'));
|
|
28
|
-
}).valueSeq().toList();
|
|
20
|
+
}), _class = /*#__PURE__*/function () {
|
|
21
|
+
function CacheHelper() {
|
|
22
|
+
_classCallCheck(this, CacheHelper);
|
|
29
23
|
}
|
|
30
|
-
|
|
24
|
+
_createClass(CacheHelper, [{
|
|
25
|
+
key: "state",
|
|
26
|
+
// This is needed for withStateCache to work properly :-/
|
|
27
|
+
value: function state() {
|
|
28
|
+
return reduxStore.getAppState();
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "interactionTypes",
|
|
32
|
+
value: function interactionTypes(state) {
|
|
33
|
+
return state.get('interactionTypes', Map()).filter(function (intTypeData) {
|
|
34
|
+
return featureOn('interaction_type_rich_fill_blank') ? intTypeData.get('slug') !== 'fill-blank' : intTypeData.get('slug') !== 'rich-fill-blank';
|
|
35
|
+
}).map(function (intTypeData) {
|
|
36
|
+
return getInteractionType(state, intTypeData.get('id'));
|
|
37
|
+
}).valueSeq().toList();
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
return CacheHelper;
|
|
41
|
+
}(), _applyDecoratedDescriptor(_class.prototype, "interactionTypes", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "interactionTypes"), _class.prototype), _class);
|
|
42
|
+
var cacheHelper = new CacheHelper();
|
|
31
43
|
|
|
32
44
|
// This is a hack to continue using withStateCache until we implement reselect
|
|
33
45
|
export var getInteractionTypes = cacheHelper.interactionTypes.bind(cacheHelper);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
1
3
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
2
|
-
var _dec, _dec2,
|
|
4
|
+
var _dec, _dec2, _class;
|
|
3
5
|
// TODO: Use reselect! Create a getQuizzes selector that can be used for reselecting quizzes by id
|
|
4
6
|
import { Map, List } from 'immutable';
|
|
5
7
|
import { getActiveQuizSession } from "./quizSessions.js";
|
|
@@ -54,39 +56,53 @@ export var getTemporaryQuizEntry = function getTemporaryQuizEntry(state) {
|
|
|
54
56
|
export var isActiveQuizWorkingInstanceOneQuestionAtATime = function isActiveQuizWorkingInstanceOneQuestionAtATime(state) {
|
|
55
57
|
return getActiveQuiz(state).getWorkingInstance().isOneQuestionAtATime();
|
|
56
58
|
};
|
|
57
|
-
var
|
|
59
|
+
var CacheHelper = (_dec = withStateCache(function () {
|
|
58
60
|
return [['quizEntries'], ['modifications', 'quizEntries'], ['modifications', 'items'], ['modifications', 'stimuli'], ['editing']];
|
|
59
61
|
}), _dec2 = withStateCache(function () {
|
|
60
62
|
return [['editing']];
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
quizEntryWithErrorsShowing: function quizEntryWithErrorsShowing(state) {
|
|
72
|
-
var _this = this;
|
|
73
|
-
var qeWithErrors = state.get('quizEntries').find(function (qe) {
|
|
74
|
-
return _this.__isShowingErrors(state, QuizEntry.create(qe));
|
|
75
|
-
});
|
|
76
|
-
if (qeWithErrors) {
|
|
77
|
-
return qeWithErrors;
|
|
63
|
+
}), _class = /*#__PURE__*/function () {
|
|
64
|
+
function CacheHelper() {
|
|
65
|
+
_classCallCheck(this, CacheHelper);
|
|
66
|
+
}
|
|
67
|
+
_createClass(CacheHelper, [{
|
|
68
|
+
key: "state",
|
|
69
|
+
// This is needed for withStateCache to work properly :-/
|
|
70
|
+
value: function state() {
|
|
71
|
+
return reduxStore.getAppState();
|
|
78
72
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
}, {
|
|
74
|
+
key: "__isShowingErrors",
|
|
75
|
+
value: function __isShowingErrors(state, quizEntry) {
|
|
76
|
+
var isInvalid = !quizEntry.getEntry().getWorkingInstance().isValid();
|
|
77
|
+
var isEditing = state.getIn(['editing', "".concat(quizEntry.id, "_").concat(QUIZ_ENTRY_GUID_SUFFIX)]);
|
|
78
|
+
return isInvalid && isEditing;
|
|
82
79
|
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "quizEntryWithErrorsShowing",
|
|
82
|
+
value: function quizEntryWithErrorsShowing(state) {
|
|
83
|
+
var _this = this;
|
|
84
|
+
var qeWithErrors = state.get('quizEntries').find(function (qe) {
|
|
85
|
+
return _this.__isShowingErrors(state, QuizEntry.create(qe));
|
|
86
|
+
});
|
|
87
|
+
if (qeWithErrors) {
|
|
88
|
+
return qeWithErrors;
|
|
89
|
+
}
|
|
90
|
+
var temp = getTemporaryQuizEntry(state);
|
|
91
|
+
if (this.__isShowingErrors(state, temp)) {
|
|
92
|
+
return temp;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "editingQuizEntry",
|
|
97
|
+
value: function editingQuizEntry(state) {
|
|
98
|
+
return state.get('editing', []).find(function (isEditing, key) {
|
|
99
|
+
return isEditing && key.includes(QUIZ_ENTRY_GUID_SUFFIX);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
103
|
+
return CacheHelper;
|
|
104
|
+
}(), _applyDecoratedDescriptor(_class.prototype, "quizEntryWithErrorsShowing", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "quizEntryWithErrorsShowing"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "editingQuizEntry", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "editingQuizEntry"), _class.prototype), _class);
|
|
105
|
+
var cacheHelper = new CacheHelper();
|
|
90
106
|
|
|
91
107
|
// This is a hack to continue using withStateCache until we implement reselect
|
|
92
108
|
export var getQuizEntryWithErrorsShowing = cacheHelper.quizEntryWithErrorsShowing.bind(cacheHelper);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
1
3
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
2
|
-
var
|
|
4
|
+
var _class;
|
|
3
5
|
import { List } from 'immutable';
|
|
4
6
|
import SessionItemResult from "../records/SessionItemResult.js";
|
|
5
7
|
import withCachedArguments from "../util/withCachedArguments.js";
|
|
@@ -13,11 +15,19 @@ export function getSessionItemResultsByIds(state) {
|
|
|
13
15
|
export function getSessionItemResultById(state, id) {
|
|
14
16
|
return SessionItemResult.create(state.getIn(['sessionItemResults', "".concat(id)]));
|
|
15
17
|
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
var CacheHelper = (_class = /*#__PURE__*/function () {
|
|
19
|
+
function CacheHelper() {
|
|
20
|
+
_classCallCheck(this, CacheHelper);
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
_createClass(CacheHelper, [{
|
|
23
|
+
key: "gradingSessionItemResults",
|
|
24
|
+
value: function gradingSessionItemResults(sessionItemResults, scope) {
|
|
25
|
+
return sessionItemResults.toList().filter(scope);
|
|
26
|
+
}
|
|
27
|
+
}]);
|
|
28
|
+
return CacheHelper;
|
|
29
|
+
}(), _applyDecoratedDescriptor(_class.prototype, "gradingSessionItemResults", [withCachedArguments], Object.getOwnPropertyDescriptor(_class.prototype, "gradingSessionItemResults"), _class.prototype), _class);
|
|
30
|
+
var cacheHelper = new CacheHelper();
|
|
21
31
|
|
|
22
32
|
// This is a hack to continue using withCachedArguments until we implement reselect
|
|
23
33
|
export var getGradingSessionItemResults = cacheHelper.gradingSessionItemResults.bind(cacheHelper);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
1
3
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
2
|
-
var
|
|
4
|
+
var _class;
|
|
3
5
|
import SessionItem from "../records/SessionItem.js";
|
|
4
6
|
import { List } from 'immutable';
|
|
5
7
|
import withCachedArguments from "../util/withCachedArguments.js";
|
|
@@ -19,15 +21,23 @@ export function getSessionItemsByIds(state) {
|
|
|
19
21
|
export function getSessionItemById(state, id) {
|
|
20
22
|
return SessionItem.create(state.getIn(['sessionItems', id]));
|
|
21
23
|
}
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return SessionItem.create(si);
|
|
26
|
-
}).sortBy(function (si) {
|
|
27
|
-
return si.position;
|
|
28
|
-
}).toList();
|
|
24
|
+
var CacheHelper = (_class = /*#__PURE__*/function () {
|
|
25
|
+
function CacheHelper() {
|
|
26
|
+
_classCallCheck(this, CacheHelper);
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
_createClass(CacheHelper, [{
|
|
29
|
+
key: "gradingSessionItems",
|
|
30
|
+
value: function gradingSessionItems(sessionItems, scope) {
|
|
31
|
+
return sessionItems.filter(scope).map(function (si) {
|
|
32
|
+
return SessionItem.create(si);
|
|
33
|
+
}).sortBy(function (si) {
|
|
34
|
+
return si.position;
|
|
35
|
+
}).toList();
|
|
36
|
+
}
|
|
37
|
+
}]);
|
|
38
|
+
return CacheHelper;
|
|
39
|
+
}(), _applyDecoratedDescriptor(_class.prototype, "gradingSessionItems", [withCachedArguments], Object.getOwnPropertyDescriptor(_class.prototype, "gradingSessionItems"), _class.prototype), _class);
|
|
40
|
+
var cacheHelper = new CacheHelper();
|
|
31
41
|
|
|
32
42
|
// This is a hack to continue using withCachedArguments until we implement reselect
|
|
33
43
|
export var getGradingSessionItems = cacheHelper.gradingSessionItems.bind(cacheHelper);
|
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.getInteractionTypes = exports.getInteractionType = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
10
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
9
11
|
var _immutable = require("immutable");
|
|
10
12
|
var _interactionTypeRecordForItem = _interopRequireDefault(require("../util/interactionTypeRecordForItem.js"));
|
|
11
13
|
var _withStateCache = _interopRequireDefault(require("../util/withStateCache.js"));
|
|
12
14
|
var _reduxStore = _interopRequireDefault(require("../../reduxStore.js"));
|
|
13
15
|
var _featureCheck = require("../util/featureCheck.js");
|
|
14
|
-
var _dec,
|
|
16
|
+
var _dec, _class; // TODO: Use more reselect! Create a getInteractionTypes selector that can be used for reselecting interaction types by
|
|
15
17
|
// id(s)
|
|
16
18
|
var getInteractionType = function getInteractionType(state, id) {
|
|
17
19
|
var interactionTypeData = state.getIn(['interactionTypes', id]) || (0, _immutable.Map)();
|
|
@@ -20,21 +22,31 @@ var getInteractionType = function getInteractionType(state, id) {
|
|
|
20
22
|
return new IntTypeRecord(interactionTypeData);
|
|
21
23
|
};
|
|
22
24
|
exports.getInteractionType = getInteractionType;
|
|
23
|
-
var
|
|
25
|
+
var CacheHelper = (_dec = (0, _withStateCache.default)(function () {
|
|
24
26
|
return [['interactionTypes']];
|
|
25
|
-
}),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return _reduxStore.default.getAppState();
|
|
29
|
-
},
|
|
30
|
-
interactionTypes: function interactionTypes(state) {
|
|
31
|
-
return state.get('interactionTypes', (0, _immutable.Map)()).filter(function (intTypeData) {
|
|
32
|
-
return (0, _featureCheck.featureOn)('interaction_type_rich_fill_blank') ? intTypeData.get('slug') !== 'fill-blank' : intTypeData.get('slug') !== 'rich-fill-blank';
|
|
33
|
-
}).map(function (intTypeData) {
|
|
34
|
-
return getInteractionType(state, intTypeData.get('id'));
|
|
35
|
-
}).valueSeq().toList();
|
|
27
|
+
}), _class = /*#__PURE__*/function () {
|
|
28
|
+
function CacheHelper() {
|
|
29
|
+
(0, _classCallCheck2.default)(this, CacheHelper);
|
|
36
30
|
}
|
|
37
|
-
|
|
31
|
+
(0, _createClass2.default)(CacheHelper, [{
|
|
32
|
+
key: "state",
|
|
33
|
+
// This is needed for withStateCache to work properly :-/
|
|
34
|
+
value: function state() {
|
|
35
|
+
return _reduxStore.default.getAppState();
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "interactionTypes",
|
|
39
|
+
value: function interactionTypes(state) {
|
|
40
|
+
return state.get('interactionTypes', (0, _immutable.Map)()).filter(function (intTypeData) {
|
|
41
|
+
return (0, _featureCheck.featureOn)('interaction_type_rich_fill_blank') ? intTypeData.get('slug') !== 'fill-blank' : intTypeData.get('slug') !== 'rich-fill-blank';
|
|
42
|
+
}).map(function (intTypeData) {
|
|
43
|
+
return getInteractionType(state, intTypeData.get('id'));
|
|
44
|
+
}).valueSeq().toList();
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return CacheHelper;
|
|
48
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "interactionTypes", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "interactionTypes"), _class.prototype), _class);
|
|
49
|
+
var cacheHelper = new CacheHelper();
|
|
38
50
|
|
|
39
51
|
// This is a hack to continue using withStateCache until we implement reselect
|
|
40
52
|
var getInteractionTypes = cacheHelper.interactionTypes.bind(cacheHelper);
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.isEditingQuizEntry = exports.getQuizEntryWithErrorsShowing = exports.isActiveQuizWorkingInstanceOneQuestionAtATime = exports.getTemporaryQuizEntry = exports.getQuizEntryById = exports.getQuizEntriesByIds = exports.getQuizEntriesByQuizId = exports.getTotalPointsPossible = exports.getQuizById = exports.getActiveQuizCaluclatorType = exports.getActiveQuizId = exports.getActiveQuiz = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
10
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
9
11
|
var _immutable = require("immutable");
|
|
10
12
|
var _quizSessions = require("./quizSessions.js");
|
|
@@ -13,7 +15,7 @@ var _QuizEntry = _interopRequireDefault(require("../records/QuizEntry.js"));
|
|
|
13
15
|
var _quizCommon = require("@instructure/quiz-common");
|
|
14
16
|
var _withStateCache = _interopRequireDefault(require("../util/withStateCache.js"));
|
|
15
17
|
var _reduxStore = _interopRequireDefault(require("../../reduxStore.js"));
|
|
16
|
-
var _dec, _dec2,
|
|
18
|
+
var _dec, _dec2, _class; // TODO: Use reselect! Create a getQuizzes selector that can be used for reselecting quizzes by id
|
|
17
19
|
var path = 'quizzes';
|
|
18
20
|
var getActiveQuiz = function getActiveQuiz(state) {
|
|
19
21
|
return getQuizById(state, getActiveQuizId(state));
|
|
@@ -70,39 +72,53 @@ var isActiveQuizWorkingInstanceOneQuestionAtATime = function isActiveQuizWorking
|
|
|
70
72
|
return getActiveQuiz(state).getWorkingInstance().isOneQuestionAtATime();
|
|
71
73
|
};
|
|
72
74
|
exports.isActiveQuizWorkingInstanceOneQuestionAtATime = isActiveQuizWorkingInstanceOneQuestionAtATime;
|
|
73
|
-
var
|
|
75
|
+
var CacheHelper = (_dec = (0, _withStateCache.default)(function () {
|
|
74
76
|
return [['quizEntries'], ['modifications', 'quizEntries'], ['modifications', 'items'], ['modifications', 'stimuli'], ['editing']];
|
|
75
77
|
}), _dec2 = (0, _withStateCache.default)(function () {
|
|
76
78
|
return [['editing']];
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
quizEntryWithErrorsShowing: function quizEntryWithErrorsShowing(state) {
|
|
88
|
-
var _this = this;
|
|
89
|
-
var qeWithErrors = state.get('quizEntries').find(function (qe) {
|
|
90
|
-
return _this.__isShowingErrors(state, _QuizEntry.default.create(qe));
|
|
91
|
-
});
|
|
92
|
-
if (qeWithErrors) {
|
|
93
|
-
return qeWithErrors;
|
|
79
|
+
}), _class = /*#__PURE__*/function () {
|
|
80
|
+
function CacheHelper() {
|
|
81
|
+
(0, _classCallCheck2.default)(this, CacheHelper);
|
|
82
|
+
}
|
|
83
|
+
(0, _createClass2.default)(CacheHelper, [{
|
|
84
|
+
key: "state",
|
|
85
|
+
// This is needed for withStateCache to work properly :-/
|
|
86
|
+
value: function state() {
|
|
87
|
+
return _reduxStore.default.getAppState();
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
}, {
|
|
90
|
+
key: "__isShowingErrors",
|
|
91
|
+
value: function __isShowingErrors(state, quizEntry) {
|
|
92
|
+
var isInvalid = !quizEntry.getEntry().getWorkingInstance().isValid();
|
|
93
|
+
var isEditing = state.getIn(['editing', "".concat(quizEntry.id, "_").concat(_quizCommon.QUIZ_ENTRY_GUID_SUFFIX)]);
|
|
94
|
+
return isInvalid && isEditing;
|
|
98
95
|
}
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "quizEntryWithErrorsShowing",
|
|
98
|
+
value: function quizEntryWithErrorsShowing(state) {
|
|
99
|
+
var _this = this;
|
|
100
|
+
var qeWithErrors = state.get('quizEntries').find(function (qe) {
|
|
101
|
+
return _this.__isShowingErrors(state, _QuizEntry.default.create(qe));
|
|
102
|
+
});
|
|
103
|
+
if (qeWithErrors) {
|
|
104
|
+
return qeWithErrors;
|
|
105
|
+
}
|
|
106
|
+
var temp = getTemporaryQuizEntry(state);
|
|
107
|
+
if (this.__isShowingErrors(state, temp)) {
|
|
108
|
+
return temp;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "editingQuizEntry",
|
|
113
|
+
value: function editingQuizEntry(state) {
|
|
114
|
+
return state.get('editing', []).find(function (isEditing, key) {
|
|
115
|
+
return isEditing && key.includes(_quizCommon.QUIZ_ENTRY_GUID_SUFFIX);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}]);
|
|
119
|
+
return CacheHelper;
|
|
120
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "quizEntryWithErrorsShowing", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "quizEntryWithErrorsShowing"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "editingQuizEntry", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "editingQuizEntry"), _class.prototype), _class);
|
|
121
|
+
var cacheHelper = new CacheHelper();
|
|
106
122
|
|
|
107
123
|
// This is a hack to continue using withStateCache until we implement reselect
|
|
108
124
|
var getQuizEntryWithErrorsShowing = cacheHelper.quizEntryWithErrorsShowing.bind(cacheHelper);
|
|
@@ -7,11 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getSessionItemResultsByIds = getSessionItemResultsByIds;
|
|
8
8
|
exports.getSessionItemResultById = getSessionItemResultById;
|
|
9
9
|
exports.getGradingSessionItemResults = void 0;
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
12
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
11
13
|
var _immutable = require("immutable");
|
|
12
14
|
var _SessionItemResult = _interopRequireDefault(require("../records/SessionItemResult.js"));
|
|
13
15
|
var _withCachedArguments = _interopRequireDefault(require("../util/withCachedArguments.js"));
|
|
14
|
-
var
|
|
16
|
+
var _class;
|
|
15
17
|
function getSessionItemResultsByIds(state) {
|
|
16
18
|
var ids = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
17
19
|
return ids.reduce(function (list, id) {
|
|
@@ -22,11 +24,19 @@ function getSessionItemResultsByIds(state) {
|
|
|
22
24
|
function getSessionItemResultById(state, id) {
|
|
23
25
|
return _SessionItemResult.default.create(state.getIn(['sessionItemResults', "".concat(id)]));
|
|
24
26
|
}
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
var CacheHelper = (_class = /*#__PURE__*/function () {
|
|
28
|
+
function CacheHelper() {
|
|
29
|
+
(0, _classCallCheck2.default)(this, CacheHelper);
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
(0, _createClass2.default)(CacheHelper, [{
|
|
32
|
+
key: "gradingSessionItemResults",
|
|
33
|
+
value: function gradingSessionItemResults(sessionItemResults, scope) {
|
|
34
|
+
return sessionItemResults.toList().filter(scope);
|
|
35
|
+
}
|
|
36
|
+
}]);
|
|
37
|
+
return CacheHelper;
|
|
38
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "gradingSessionItemResults", [_withCachedArguments.default], Object.getOwnPropertyDescriptor(_class.prototype, "gradingSessionItemResults"), _class.prototype), _class);
|
|
39
|
+
var cacheHelper = new CacheHelper();
|
|
30
40
|
|
|
31
41
|
// This is a hack to continue using withCachedArguments until we implement reselect
|
|
32
42
|
var getGradingSessionItemResults = cacheHelper.gradingSessionItemResults.bind(cacheHelper);
|
|
@@ -8,11 +8,13 @@ exports.getItemByPosition = getItemByPosition;
|
|
|
8
8
|
exports.getSessionItemsByIds = getSessionItemsByIds;
|
|
9
9
|
exports.getSessionItemById = getSessionItemById;
|
|
10
10
|
exports.getGradingSessionItems = void 0;
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
13
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
12
14
|
var _SessionItem = _interopRequireDefault(require("../records/SessionItem.js"));
|
|
13
15
|
var _immutable = require("immutable");
|
|
14
16
|
var _withCachedArguments = _interopRequireDefault(require("../util/withCachedArguments.js"));
|
|
15
|
-
var
|
|
17
|
+
var _class;
|
|
16
18
|
function getItemByPosition(state, position) {
|
|
17
19
|
var activeSessionId = state.getIn(['quizSessions', 'activeQuizSessionId']);
|
|
18
20
|
return state.get('sessionItems').find(function (item) {
|
|
@@ -29,15 +31,23 @@ function getSessionItemsByIds(state) {
|
|
|
29
31
|
function getSessionItemById(state, id) {
|
|
30
32
|
return _SessionItem.default.create(state.getIn(['sessionItems', id]));
|
|
31
33
|
}
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return _SessionItem.default.create(si);
|
|
36
|
-
}).sortBy(function (si) {
|
|
37
|
-
return si.position;
|
|
38
|
-
}).toList();
|
|
34
|
+
var CacheHelper = (_class = /*#__PURE__*/function () {
|
|
35
|
+
function CacheHelper() {
|
|
36
|
+
(0, _classCallCheck2.default)(this, CacheHelper);
|
|
39
37
|
}
|
|
40
|
-
|
|
38
|
+
(0, _createClass2.default)(CacheHelper, [{
|
|
39
|
+
key: "gradingSessionItems",
|
|
40
|
+
value: function gradingSessionItems(sessionItems, scope) {
|
|
41
|
+
return sessionItems.filter(scope).map(function (si) {
|
|
42
|
+
return _SessionItem.default.create(si);
|
|
43
|
+
}).sortBy(function (si) {
|
|
44
|
+
return si.position;
|
|
45
|
+
}).toList();
|
|
46
|
+
}
|
|
47
|
+
}]);
|
|
48
|
+
return CacheHelper;
|
|
49
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "gradingSessionItems", [_withCachedArguments.default], Object.getOwnPropertyDescriptor(_class.prototype, "gradingSessionItems"), _class.prototype), _class);
|
|
50
|
+
var cacheHelper = new CacheHelper();
|
|
41
51
|
|
|
42
52
|
// This is a hack to continue using withCachedArguments until we implement reselect
|
|
43
53
|
var getGradingSessionItems = cacheHelper.gradingSessionItems.bind(cacheHelper);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.30.0",
|
|
3
|
+
"version": "20.30.1-snapshot.0+62dfbbb2f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"snyk:monitor": "snyk monitor",
|
|
28
28
|
"postbuild": "cp src/banks/components/noResults.svg lib/banks/components/; cp src/banks/components/noResults.svg es/banks/components/; yarn postbuild:errorImage",
|
|
29
29
|
"postbuild:all": "yarn postbuild",
|
|
30
|
-
"postbuild:errorImage": "cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg es/reporting/components/resources/NewQuizAndItemAnalysis/; cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg lib/reporting/components/resources/NewQuizAndItemAnalysis/"
|
|
30
|
+
"postbuild:errorImage": "cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg es/reporting/components/resources/NewQuizAndItemAnalysis/; cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg lib/reporting/components/resources/NewQuizAndItemAnalysis/",
|
|
31
|
+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\""
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"react",
|
|
@@ -44,11 +45,11 @@
|
|
|
44
45
|
"@instructure/emotion": "^8.51.0",
|
|
45
46
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
47
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
47
|
-
"@instructure/quiz-common": "
|
|
48
|
-
"@instructure/quiz-i18n": "
|
|
49
|
-
"@instructure/quiz-interactions": "
|
|
50
|
-
"@instructure/quiz-number-input": "
|
|
51
|
-
"@instructure/quiz-rce": "
|
|
48
|
+
"@instructure/quiz-common": "20.30.1-snapshot.0+62dfbbb2f",
|
|
49
|
+
"@instructure/quiz-i18n": "20.30.1-snapshot.0+62dfbbb2f",
|
|
50
|
+
"@instructure/quiz-interactions": "20.30.1-snapshot.0+62dfbbb2f",
|
|
51
|
+
"@instructure/quiz-number-input": "20.30.1-snapshot.0+62dfbbb2f",
|
|
52
|
+
"@instructure/quiz-rce": "20.30.1-snapshot.0+62dfbbb2f",
|
|
52
53
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
54
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
55
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"file-saver": "~2.0.5",
|
|
113
114
|
"humps": "^2.0.0",
|
|
114
115
|
"immutable": "^3.8.1",
|
|
115
|
-
"instructure-validations": "
|
|
116
|
+
"instructure-validations": "20.30.1-snapshot.0+62dfbbb2f",
|
|
116
117
|
"ipaddr.js": "^1.5.4",
|
|
117
118
|
"isomorphic-fetch": "^2.2.0",
|
|
118
119
|
"isuuid": "^0.1.0",
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
"uuid": "^3.2.1"
|
|
144
145
|
},
|
|
145
146
|
"devDependencies": {
|
|
146
|
-
"@instructure/quiz-scripts": "
|
|
147
|
+
"@instructure/quiz-scripts": "20.30.0",
|
|
147
148
|
"@instructure/ui-axe-check": "^8.51.0",
|
|
148
149
|
"@instructure/ui-babel-preset": "^7.22.1",
|
|
149
150
|
"@instructure/ui-test-utils": "^7.22.1",
|
|
@@ -161,7 +162,7 @@
|
|
|
161
162
|
"jquery": "^2.2.3",
|
|
162
163
|
"karma-junit-reporter": "^2.0.1",
|
|
163
164
|
"most-subject": "^5.3.0",
|
|
164
|
-
"quiz-presets": "
|
|
165
|
+
"quiz-presets": "20.30.1-snapshot.0+62dfbbb2f",
|
|
165
166
|
"react": "^16.8.6",
|
|
166
167
|
"react-addons-test-utils": "^15.6.2",
|
|
167
168
|
"react-dom": "^16.8.6",
|
|
@@ -176,5 +177,6 @@
|
|
|
176
177
|
},
|
|
177
178
|
"publishConfig": {
|
|
178
179
|
"access": "public"
|
|
179
|
-
}
|
|
180
|
+
},
|
|
181
|
+
"gitHead": "62dfbbb2fd54f6ee71f441777d40e9bdbb0a7e15"
|
|
180
182
|
}
|