@instructure/quiz-core 17.59.0 → 17.59.1-rc.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/es/common/util/formatTimespan.js +6 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +1 -7
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +134 -110
- package/lib/common/util/formatTimespan.js +9 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +1 -8
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +139 -110
- package/package.json +11 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
2
3
|
var minuteDuration = 60;
|
|
3
4
|
var hourDuration = 3600;
|
|
4
5
|
|
|
@@ -60,4 +61,9 @@ export function formatTimeToFullNumeric(seconds) {
|
|
|
60
61
|
var minutesStr = minutes < 10 ? '0' + minutes : minutes;
|
|
61
62
|
var secsStr = secs < 10 ? '0' + secs : secs;
|
|
62
63
|
return "".concat(hoursStr, ":").concat(minutesStr, ":").concat(secsStr);
|
|
64
|
+
}
|
|
65
|
+
export function displayDateAndTimeInTimezone(utcDateTime, userTimezone, locale) {
|
|
66
|
+
return DateTime.fromISO(utcDateTime, {
|
|
67
|
+
zone: userTimezone
|
|
68
|
+
}).setLocale(locale).toLocaleString(DateTime.DATETIME_MED);
|
|
63
69
|
}
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -21,7 +21,6 @@ var styles = {
|
|
|
21
21
|
};
|
|
22
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
23
|
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
24
|
-
import { Text } from '@instructure/ui-text';
|
|
25
24
|
import { themeable } from '@instructure/ui-themeable';
|
|
26
25
|
import theme from "./theme.js";
|
|
27
26
|
import { formatTimeToFullNumeric } from "../../../../../common/util/formatTimespan.js";
|
|
@@ -42,9 +41,6 @@ var cronbachsAlphaPopoverTexts = {
|
|
|
42
41
|
body: 'cronbach\'s alpha description',
|
|
43
42
|
screenReaderLabel: 'cronbach\'s alpha tooltip'
|
|
44
43
|
};
|
|
45
|
-
|
|
46
|
-
var _ref = /*#__PURE__*/React.createElement("br", null);
|
|
47
|
-
|
|
48
44
|
export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
49
45
|
_inherits(NewQuizAnalysis, _Component);
|
|
50
46
|
|
|
@@ -149,9 +145,7 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
149
145
|
isExpanded: expanded
|
|
150
146
|
}))), expanded && this.renderExpanded(), /*#__PURE__*/React.createElement(ScoreDistribution, {
|
|
151
147
|
decileDistribution: quizAnalysis.scores.decile_distribution
|
|
152
|
-
})
|
|
153
|
-
size: "x-small"
|
|
154
|
-
}, _ref, /*#__PURE__*/React.createElement("b", null, t('Data Last Updated:')), "\xA0", t.date(Date.parse(quizAnalysis.created_timestamp), 'medium')));
|
|
148
|
+
}));
|
|
155
149
|
}
|
|
156
150
|
}]);
|
|
157
151
|
|
|
@@ -1,126 +1,150 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import React, { Component } from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
6
9
|
import { Heading } from '@instructure/ui-heading';
|
|
7
10
|
import NewItemAnalysis from "./NewItemAnalysis/index.js";
|
|
8
11
|
import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
|
|
9
12
|
import NewQuizAnalysis from "./NewQuizAnalysis/index.js";
|
|
13
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
|
+
import { Text } from '@instructure/ui-text';
|
|
15
|
+
import { Flex } from '@instructure/ui-flex';
|
|
16
|
+
import { displayDateAndTimeInTimezone } from "../../../../common/util/formatTimespan.js";
|
|
10
17
|
|
|
11
|
-
var
|
|
12
|
-
level: "h3",
|
|
13
|
-
color: "primary"
|
|
14
|
-
}, "Item analysis");
|
|
15
|
-
|
|
16
|
-
var _ref6 = /*#__PURE__*/React.createElement(Spinner, null);
|
|
17
|
-
|
|
18
|
-
export var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
|
|
19
|
-
var activeQuizId = _ref.activeQuizId,
|
|
20
|
-
getQuizAnalysis = _ref.getQuizAnalysis,
|
|
21
|
-
getItemAnalyses = _ref.getItemAnalyses;
|
|
22
|
-
|
|
23
|
-
var _useState = useState(null),
|
|
24
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
-
quizAnalysis = _useState2[0],
|
|
26
|
-
setQuizAnalysis = _useState2[1];
|
|
27
|
-
|
|
28
|
-
var _useState3 = useState(null),
|
|
29
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
-
itemAnalyses = _useState4[0],
|
|
31
|
-
setItemAnalyses = _useState4[1];
|
|
32
|
-
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
var fetch = /*#__PURE__*/function () {
|
|
35
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
36
|
-
var response;
|
|
37
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
38
|
-
while (1) {
|
|
39
|
-
switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
_context.next = 2;
|
|
42
|
-
return getQuizAnalysis(activeQuizId);
|
|
43
|
-
|
|
44
|
-
case 2:
|
|
45
|
-
response = _context.sent;
|
|
46
|
-
|
|
47
|
-
if (response) {
|
|
48
|
-
setQuizAnalysis(response.last_successful_analysis);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
case 4:
|
|
52
|
-
case "end":
|
|
53
|
-
return _context.stop();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, _callee);
|
|
57
|
-
}));
|
|
18
|
+
var _ref3 = /*#__PURE__*/React.createElement(Spinner, null);
|
|
58
19
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
}();
|
|
63
|
-
|
|
64
|
-
fetch();
|
|
65
|
-
}, []);
|
|
66
|
-
useEffect(function () {
|
|
67
|
-
var fetch = /*#__PURE__*/function () {
|
|
68
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
69
|
-
var response;
|
|
70
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
71
|
-
while (1) {
|
|
72
|
-
switch (_context2.prev = _context2.next) {
|
|
73
|
-
case 0:
|
|
74
|
-
_context2.next = 2;
|
|
75
|
-
return getItemAnalyses(activeQuizId);
|
|
76
|
-
|
|
77
|
-
case 2:
|
|
78
|
-
response = _context2.sent;
|
|
79
|
-
|
|
80
|
-
if (response) {
|
|
81
|
-
setItemAnalyses(response.last_successful_analysis);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
case 4:
|
|
85
|
-
case "end":
|
|
86
|
-
return _context2.stop();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, _callee2);
|
|
90
|
-
}));
|
|
20
|
+
export var NewQuizAndItemAnalysis = /*#__PURE__*/function (_Component) {
|
|
21
|
+
_inherits(NewQuizAndItemAnalysis, _Component);
|
|
91
22
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
var renderContent = function renderContent() {
|
|
105
|
-
/* eslint-disable react/jsx-no-literals */
|
|
106
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
className: "fs-mask"
|
|
108
|
-
}, _ref4, _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
109
|
-
return /*#__PURE__*/React.createElement(NewItemAnalysis, {
|
|
110
|
-
key: itemAnalysis.metadata.item_id,
|
|
111
|
-
itemAnalysis: itemAnalysis
|
|
112
|
-
});
|
|
113
|
-
}));
|
|
114
|
-
/* eslint-enable react/jsx-no-literals */
|
|
115
|
-
}; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
|
|
116
|
-
// once it is known how will be such a case handled by the backend
|
|
23
|
+
var _super = _createSuper(NewQuizAndItemAnalysis);
|
|
24
|
+
|
|
25
|
+
function NewQuizAndItemAnalysis(props) {
|
|
26
|
+
var _this;
|
|
27
|
+
|
|
28
|
+
_classCallCheck(this, NewQuizAndItemAnalysis);
|
|
29
|
+
|
|
30
|
+
_this = _super.call(this, props);
|
|
31
|
+
_this.fetchQuizAnalysis = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
32
|
+
var _this$props, activeQuizId, getQuizAnalysis, response;
|
|
117
33
|
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
+
while (1) {
|
|
36
|
+
switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
_this$props = _this.props, activeQuizId = _this$props.activeQuizId, getQuizAnalysis = _this$props.getQuizAnalysis;
|
|
39
|
+
_context.next = 3;
|
|
40
|
+
return getQuizAnalysis(activeQuizId);
|
|
118
41
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
42
|
+
case 3:
|
|
43
|
+
response = _context.sent;
|
|
44
|
+
|
|
45
|
+
if (response) {
|
|
46
|
+
_this.setState({
|
|
47
|
+
quizAnalysis: response.last_successful_analysis
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
case 5:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, _callee);
|
|
57
|
+
}));
|
|
58
|
+
_this.fetchItemAnalyses = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
59
|
+
var _this$props2, activeQuizId, getItemAnalyses, response;
|
|
60
|
+
|
|
61
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
_this$props2 = _this.props, activeQuizId = _this$props2.activeQuizId, getItemAnalyses = _this$props2.getItemAnalyses;
|
|
66
|
+
_context2.next = 3;
|
|
67
|
+
return getItemAnalyses(activeQuizId);
|
|
68
|
+
|
|
69
|
+
case 3:
|
|
70
|
+
response = _context2.sent;
|
|
71
|
+
|
|
72
|
+
if (response) {
|
|
73
|
+
_this.setState({
|
|
74
|
+
itemAnalyses: response.last_successful_analysis
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
case 5:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context2.stop();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, _callee2);
|
|
84
|
+
}));
|
|
85
|
+
_this.state = {
|
|
86
|
+
quizAnalysis: null,
|
|
87
|
+
itemAnalyses: null
|
|
88
|
+
};
|
|
89
|
+
return _this;
|
|
123
90
|
}
|
|
91
|
+
|
|
92
|
+
_createClass(NewQuizAndItemAnalysis, [{
|
|
93
|
+
key: "componentDidMount",
|
|
94
|
+
value: function componentDidMount() {
|
|
95
|
+
this.fetchQuizAnalysis();
|
|
96
|
+
this.fetchItemAnalyses();
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "renderContent",
|
|
100
|
+
value: function renderContent() {
|
|
101
|
+
var _this$state = this.state,
|
|
102
|
+
quizAnalysis = _this$state.quizAnalysis,
|
|
103
|
+
itemAnalyses = _this$state.itemAnalyses;
|
|
104
|
+
var _this$context = this.context,
|
|
105
|
+
timezone = _this$context.timezone,
|
|
106
|
+
locale = _this$context.locale;
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "fs-mask"
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
110
|
+
justifyItems: "end",
|
|
111
|
+
width: "82.5rem",
|
|
112
|
+
margin: "auto"
|
|
113
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
114
|
+
size: "x-small"
|
|
115
|
+
}, /*#__PURE__*/React.createElement("b", null, t('Data Last Updated:')), "\xA0", displayDateAndTimeInTimezone(quizAnalysis.created_timestamp, timezone, locale))), /*#__PURE__*/React.createElement(NewQuizAnalysis, {
|
|
116
|
+
quizAnalysis: quizAnalysis
|
|
117
|
+
}), /*#__PURE__*/React.createElement(Heading, {
|
|
118
|
+
level: "h3",
|
|
119
|
+
color: "primary"
|
|
120
|
+
}, t('Item Analysis')), itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
121
|
+
return /*#__PURE__*/React.createElement(NewItemAnalysis, {
|
|
122
|
+
key: itemAnalysis.metadata.item_id,
|
|
123
|
+
itemAnalysis: itemAnalysis
|
|
124
|
+
});
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "render",
|
|
129
|
+
value: function render() {
|
|
130
|
+
var _this$state2 = this.state,
|
|
131
|
+
quizAnalysis = _this$state2.quizAnalysis,
|
|
132
|
+
itemAnalyses = _this$state2.itemAnalyses;
|
|
133
|
+
|
|
134
|
+
if (quizAnalysis && itemAnalyses) {
|
|
135
|
+
return this.renderContent();
|
|
136
|
+
} else {
|
|
137
|
+
return _ref3;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}]);
|
|
141
|
+
|
|
142
|
+
NewQuizAndItemAnalysis.displayName = "NewQuizAndItemAnalysis";
|
|
143
|
+
return NewQuizAndItemAnalysis;
|
|
144
|
+
}(Component);
|
|
145
|
+
NewQuizAndItemAnalysis.contextTypes = {
|
|
146
|
+
timezone: PropTypes.string,
|
|
147
|
+
locale: PropTypes.string
|
|
124
148
|
};
|
|
125
149
|
NewQuizAndItemAnalysis.propTypes = {
|
|
126
150
|
activeQuizId: PropTypes.string.isRequired,
|
|
@@ -7,10 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.formatTime = formatTime;
|
|
9
9
|
exports.formatTimeToFullNumeric = formatTimeToFullNumeric;
|
|
10
|
+
exports.displayDateAndTimeInTimezone = displayDateAndTimeInTimezone;
|
|
10
11
|
exports.formatTimespan = void 0;
|
|
11
12
|
|
|
12
13
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
13
14
|
|
|
15
|
+
var _luxon = require("luxon");
|
|
16
|
+
|
|
14
17
|
var minuteDuration = 60;
|
|
15
18
|
var hourDuration = 3600;
|
|
16
19
|
|
|
@@ -76,4 +79,10 @@ function formatTimeToFullNumeric(seconds) {
|
|
|
76
79
|
var minutesStr = minutes < 10 ? '0' + minutes : minutes;
|
|
77
80
|
var secsStr = secs < 10 ? '0' + secs : secs;
|
|
78
81
|
return "".concat(hoursStr, ":").concat(minutesStr, ":").concat(secsStr);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function displayDateAndTimeInTimezone(utcDateTime, userTimezone, locale) {
|
|
85
|
+
return _luxon.DateTime.fromISO(utcDateTime, {
|
|
86
|
+
zone: userTimezone
|
|
87
|
+
}).setLocale(locale).toLocaleString(_luxon.DateTime.DATETIME_MED);
|
|
79
88
|
}
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -25,8 +25,6 @@ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/f
|
|
|
25
25
|
|
|
26
26
|
var _index = _interopRequireDefault(require("../../../../../common/components/shared/ExpandButton/index.js"));
|
|
27
27
|
|
|
28
|
-
var _uiText = require("@instructure/ui-text");
|
|
29
|
-
|
|
30
28
|
var _uiThemeable = require("@instructure/ui-themeable");
|
|
31
29
|
|
|
32
30
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -69,9 +67,6 @@ var cronbachsAlphaPopoverTexts = {
|
|
|
69
67
|
body: 'cronbach\'s alpha description',
|
|
70
68
|
screenReaderLabel: 'cronbach\'s alpha tooltip'
|
|
71
69
|
};
|
|
72
|
-
|
|
73
|
-
var _ref = /*#__PURE__*/_react.default.createElement("br", null);
|
|
74
|
-
|
|
75
70
|
var NewQuizAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
76
71
|
(0, _inherits2.default)(NewQuizAnalysis, _Component);
|
|
77
72
|
|
|
@@ -176,9 +171,7 @@ var NewQuizAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
176
171
|
isExpanded: expanded
|
|
177
172
|
}))), expanded && this.renderExpanded(), /*#__PURE__*/_react.default.createElement(_presenter.ScoreDistribution, {
|
|
178
173
|
decileDistribution: quizAnalysis.scores.decile_distribution
|
|
179
|
-
})
|
|
180
|
-
size: "x-small"
|
|
181
|
-
}, _ref, /*#__PURE__*/_react.default.createElement("b", null, (0, _formatMessage.default)('Data Last Updated:')), "\xA0", _formatMessage.default.date(Date.parse(quizAnalysis.created_timestamp), 'medium')));
|
|
174
|
+
}));
|
|
182
175
|
}
|
|
183
176
|
}]);
|
|
184
177
|
NewQuizAnalysis.displayName = "NewQuizAnalysis";
|
|
@@ -13,7 +13,13 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
13
13
|
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
17
23
|
|
|
18
24
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
25
|
|
|
@@ -27,122 +33,145 @@ var _Spinner = _interopRequireDefault(require("../../../../common/components/sha
|
|
|
27
33
|
|
|
28
34
|
var _index2 = _interopRequireDefault(require("./NewQuizAnalysis/index.js"));
|
|
29
35
|
|
|
30
|
-
var
|
|
31
|
-
level: "h3",
|
|
32
|
-
color: "primary"
|
|
33
|
-
}, "Item analysis");
|
|
34
|
-
|
|
35
|
-
var _ref6 = /*#__PURE__*/_react.default.createElement(_Spinner.default, null);
|
|
36
|
-
|
|
37
|
-
var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
|
|
38
|
-
var activeQuizId = _ref.activeQuizId,
|
|
39
|
-
getQuizAnalysis = _ref.getQuizAnalysis,
|
|
40
|
-
getItemAnalyses = _ref.getItemAnalyses;
|
|
41
|
-
|
|
42
|
-
var _useState = (0, _react.useState)(null),
|
|
43
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
|
-
quizAnalysis = _useState2[0],
|
|
45
|
-
setQuizAnalysis = _useState2[1];
|
|
46
|
-
|
|
47
|
-
var _useState3 = (0, _react.useState)(null),
|
|
48
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
49
|
-
itemAnalyses = _useState4[0],
|
|
50
|
-
setItemAnalyses = _useState4[1];
|
|
51
|
-
|
|
52
|
-
(0, _react.useEffect)(function () {
|
|
53
|
-
var fetch = /*#__PURE__*/function () {
|
|
54
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
55
|
-
var response;
|
|
56
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
switch (_context.prev = _context.next) {
|
|
59
|
-
case 0:
|
|
60
|
-
_context.next = 2;
|
|
61
|
-
return getQuizAnalysis(activeQuizId);
|
|
62
|
-
|
|
63
|
-
case 2:
|
|
64
|
-
response = _context.sent;
|
|
65
|
-
|
|
66
|
-
if (response) {
|
|
67
|
-
setQuizAnalysis(response.last_successful_analysis);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
case 4:
|
|
71
|
-
case "end":
|
|
72
|
-
return _context.stop();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}, _callee);
|
|
76
|
-
}));
|
|
36
|
+
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
77
37
|
|
|
78
|
-
|
|
79
|
-
return _ref2.apply(this, arguments);
|
|
80
|
-
};
|
|
81
|
-
}();
|
|
82
|
-
|
|
83
|
-
fetch();
|
|
84
|
-
}, []);
|
|
85
|
-
(0, _react.useEffect)(function () {
|
|
86
|
-
var fetch = /*#__PURE__*/function () {
|
|
87
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
88
|
-
var response;
|
|
89
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
90
|
-
while (1) {
|
|
91
|
-
switch (_context2.prev = _context2.next) {
|
|
92
|
-
case 0:
|
|
93
|
-
_context2.next = 2;
|
|
94
|
-
return getItemAnalyses(activeQuizId);
|
|
95
|
-
|
|
96
|
-
case 2:
|
|
97
|
-
response = _context2.sent;
|
|
98
|
-
|
|
99
|
-
if (response) {
|
|
100
|
-
setItemAnalyses(response.last_successful_analysis);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
case 4:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context2.stop();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}, _callee2);
|
|
109
|
-
}));
|
|
38
|
+
var _uiText = require("@instructure/ui-text");
|
|
110
39
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
var renderContent = function renderContent() {
|
|
124
|
-
/* eslint-disable react/jsx-no-literals */
|
|
125
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
126
|
-
className: "fs-mask"
|
|
127
|
-
}, _ref4, _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
128
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
129
|
-
key: itemAnalysis.metadata.item_id,
|
|
130
|
-
itemAnalysis: itemAnalysis
|
|
131
|
-
});
|
|
132
|
-
}));
|
|
133
|
-
/* eslint-enable react/jsx-no-literals */
|
|
134
|
-
}; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
|
|
135
|
-
// once it is known how will be such a case handled by the backend
|
|
40
|
+
var _uiFlex = require("@instructure/ui-flex");
|
|
41
|
+
|
|
42
|
+
var _formatTimespan = require("../../../../common/util/formatTimespan.js");
|
|
43
|
+
|
|
44
|
+
var _ref3 = /*#__PURE__*/_react.default.createElement(_Spinner.default, null);
|
|
45
|
+
|
|
46
|
+
var NewQuizAndItemAnalysis = /*#__PURE__*/function (_Component) {
|
|
47
|
+
(0, _inherits2.default)(NewQuizAndItemAnalysis, _Component);
|
|
48
|
+
|
|
49
|
+
var _super = (0, _createSuper2.default)(NewQuizAndItemAnalysis);
|
|
136
50
|
|
|
51
|
+
function NewQuizAndItemAnalysis(props) {
|
|
52
|
+
var _this;
|
|
137
53
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
54
|
+
(0, _classCallCheck2.default)(this, NewQuizAndItemAnalysis);
|
|
55
|
+
_this = _super.call(this, props);
|
|
56
|
+
_this.fetchQuizAnalysis = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
57
|
+
var _this$props, activeQuizId, getQuizAnalysis, response;
|
|
58
|
+
|
|
59
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
60
|
+
while (1) {
|
|
61
|
+
switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
_this$props = _this.props, activeQuizId = _this$props.activeQuizId, getQuizAnalysis = _this$props.getQuizAnalysis;
|
|
64
|
+
_context.next = 3;
|
|
65
|
+
return getQuizAnalysis(activeQuizId);
|
|
66
|
+
|
|
67
|
+
case 3:
|
|
68
|
+
response = _context.sent;
|
|
69
|
+
|
|
70
|
+
if (response) {
|
|
71
|
+
_this.setState({
|
|
72
|
+
quizAnalysis: response.last_successful_analysis
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
case 5:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context.stop();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, _callee);
|
|
82
|
+
}));
|
|
83
|
+
_this.fetchItemAnalyses = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
84
|
+
var _this$props2, activeQuizId, getItemAnalyses, response;
|
|
85
|
+
|
|
86
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
87
|
+
while (1) {
|
|
88
|
+
switch (_context2.prev = _context2.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
_this$props2 = _this.props, activeQuizId = _this$props2.activeQuizId, getItemAnalyses = _this$props2.getItemAnalyses;
|
|
91
|
+
_context2.next = 3;
|
|
92
|
+
return getItemAnalyses(activeQuizId);
|
|
93
|
+
|
|
94
|
+
case 3:
|
|
95
|
+
response = _context2.sent;
|
|
96
|
+
|
|
97
|
+
if (response) {
|
|
98
|
+
_this.setState({
|
|
99
|
+
itemAnalyses: response.last_successful_analysis
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case 5:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context2.stop();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, _callee2);
|
|
109
|
+
}));
|
|
110
|
+
_this.state = {
|
|
111
|
+
quizAnalysis: null,
|
|
112
|
+
itemAnalyses: null
|
|
113
|
+
};
|
|
114
|
+
return _this;
|
|
142
115
|
}
|
|
143
|
-
|
|
116
|
+
|
|
117
|
+
(0, _createClass2.default)(NewQuizAndItemAnalysis, [{
|
|
118
|
+
key: "componentDidMount",
|
|
119
|
+
value: function componentDidMount() {
|
|
120
|
+
this.fetchQuizAnalysis();
|
|
121
|
+
this.fetchItemAnalyses();
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "renderContent",
|
|
125
|
+
value: function renderContent() {
|
|
126
|
+
var _this$state = this.state,
|
|
127
|
+
quizAnalysis = _this$state.quizAnalysis,
|
|
128
|
+
itemAnalyses = _this$state.itemAnalyses;
|
|
129
|
+
var _this$context = this.context,
|
|
130
|
+
timezone = _this$context.timezone,
|
|
131
|
+
locale = _this$context.locale;
|
|
132
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
133
|
+
className: "fs-mask"
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
|
|
135
|
+
justifyItems: "end",
|
|
136
|
+
width: "82.5rem",
|
|
137
|
+
margin: "auto"
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_uiText.Text, {
|
|
139
|
+
size: "x-small"
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement("b", null, (0, _formatMessage.default)('Data Last Updated:')), "\xA0", (0, _formatTimespan.displayDateAndTimeInTimezone)(quizAnalysis.created_timestamp, timezone, locale))), /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
141
|
+
quizAnalysis: quizAnalysis
|
|
142
|
+
}), /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, {
|
|
143
|
+
level: "h3",
|
|
144
|
+
color: "primary"
|
|
145
|
+
}, (0, _formatMessage.default)('Item Analysis')), itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
147
|
+
key: itemAnalysis.metadata.item_id,
|
|
148
|
+
itemAnalysis: itemAnalysis
|
|
149
|
+
});
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "render",
|
|
154
|
+
value: function render() {
|
|
155
|
+
var _this$state2 = this.state,
|
|
156
|
+
quizAnalysis = _this$state2.quizAnalysis,
|
|
157
|
+
itemAnalyses = _this$state2.itemAnalyses;
|
|
158
|
+
|
|
159
|
+
if (quizAnalysis && itemAnalyses) {
|
|
160
|
+
return this.renderContent();
|
|
161
|
+
} else {
|
|
162
|
+
return _ref3;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}]);
|
|
166
|
+
NewQuizAndItemAnalysis.displayName = "NewQuizAndItemAnalysis";
|
|
167
|
+
return NewQuizAndItemAnalysis;
|
|
168
|
+
}(_react.Component);
|
|
144
169
|
|
|
145
170
|
exports.NewQuizAndItemAnalysis = NewQuizAndItemAnalysis;
|
|
171
|
+
NewQuizAndItemAnalysis.contextTypes = {
|
|
172
|
+
timezone: _propTypes.default.string,
|
|
173
|
+
locale: _propTypes.default.string
|
|
174
|
+
};
|
|
146
175
|
NewQuizAndItemAnalysis.propTypes = {
|
|
147
176
|
activeQuizId: _propTypes.default.string.isRequired,
|
|
148
177
|
getQuizAnalysis: _propTypes.default.func.isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.59.0",
|
|
3
|
+
"version": "17.59.1-rc.0+6d499126a",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@instructure/outcomes-ui": "^2.1.8",
|
|
44
|
-
"@instructure/quiz-common": "
|
|
45
|
-
"@instructure/quiz-i18n": "
|
|
46
|
-
"@instructure/quiz-interactions": "
|
|
47
|
-
"@instructure/quiz-number-input": "
|
|
48
|
-
"@instructure/quiz-rce": "
|
|
44
|
+
"@instructure/quiz-common": "17.59.1-rc.0+6d499126a",
|
|
45
|
+
"@instructure/quiz-i18n": "17.59.1-rc.0+6d499126a",
|
|
46
|
+
"@instructure/quiz-interactions": "17.59.1-rc.0+6d499126a",
|
|
47
|
+
"@instructure/quiz-number-input": "17.59.1-rc.0+6d499126a",
|
|
48
|
+
"@instructure/quiz-rce": "17.59.1-rc.0+6d499126a",
|
|
49
49
|
"@instructure/ui-a11y-content": "^7.20.0",
|
|
50
50
|
"@instructure/ui-alerts": "^7.20.0",
|
|
51
51
|
"@instructure/ui-avatar": "^7.20.0",
|
|
@@ -106,13 +106,14 @@
|
|
|
106
106
|
"eventemitter3": "^3.1.0",
|
|
107
107
|
"humps": "^2.0.0",
|
|
108
108
|
"immutable": "^3.8.1",
|
|
109
|
-
"instructure-validations": "
|
|
109
|
+
"instructure-validations": "17.59.1-rc.0+6d499126a",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
113
113
|
"jwt-simple": "^0.5.0",
|
|
114
114
|
"katex": "^0.10.2",
|
|
115
115
|
"lodash": "^4.0.0",
|
|
116
|
+
"luxon": "3.3.0",
|
|
116
117
|
"normalizr": "3.2.2",
|
|
117
118
|
"platform": "^1.3.1",
|
|
118
119
|
"prop-types": "^15.6.0",
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
"uuid": "^3.2.1"
|
|
138
139
|
},
|
|
139
140
|
"devDependencies": {
|
|
140
|
-
"@instructure/quiz-scripts": "
|
|
141
|
+
"@instructure/quiz-scripts": "17.59.0",
|
|
141
142
|
"@instructure/ui-axe-check": "^7.20.0",
|
|
142
143
|
"@instructure/ui-babel-preset": "^7.20.0",
|
|
143
144
|
"@instructure/ui-karma-config": "^7.20.0",
|
|
@@ -156,7 +157,7 @@
|
|
|
156
157
|
"intl": "^1.2.4",
|
|
157
158
|
"jquery": "^2.2.3",
|
|
158
159
|
"most-subject": "^5.3.0",
|
|
159
|
-
"quiz-presets": "
|
|
160
|
+
"quiz-presets": "17.59.1-rc.0+6d499126a",
|
|
160
161
|
"react": "^16.8.6",
|
|
161
162
|
"react-addons-test-utils": "^15.6.2",
|
|
162
163
|
"react-dom": "^16.8.6",
|
|
@@ -172,5 +173,5 @@
|
|
|
172
173
|
"publishConfig": {
|
|
173
174
|
"access": "public"
|
|
174
175
|
},
|
|
175
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "6d499126ac832183d9fb2bdb60a9b3c55d35a45e"
|
|
176
177
|
}
|