@instructure/quiz-core 17.58.2-rc.6 → 17.58.2-rc.8
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/banks/api/banks.js +35 -1
- package/es/banks/components/Bank/index.js +16 -7
- package/es/banks/components/Bank/presenter.js +198 -18
- package/es/building/components/resources/BanksTray/presenter.js +2 -1
- package/es/common/actions/sharedBanks.js +2 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +64 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +3 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +75 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +6 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +18 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +245 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +9 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +55 -57
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +5 -16
- package/lib/banks/api/banks.js +40 -2
- package/lib/banks/components/Bank/index.js +15 -2
- package/lib/banks/components/Bank/presenter.js +203 -17
- package/lib/building/components/resources/BanksTray/presenter.js +2 -1
- package/lib/common/actions/sharedBanks.js +2 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +83 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +10 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +95 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +27 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +274 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +16 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +59 -62
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +7 -18
- package/package.json +9 -9
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
|
|
7
|
+
var _dec, _class, _class2, _temp;
|
|
8
|
+
|
|
9
|
+
import { Heading } from '@instructure/ui-heading';
|
|
10
|
+
import React, { Component } from 'react';
|
|
11
|
+
var styles = {
|
|
12
|
+
componentId: 'dcJyB',
|
|
13
|
+
template: function template(theme) {
|
|
14
|
+
return "\n\n.dcJyB_eDnN{display:flex;flex-basis:45%;flex-direction:column;overflow:hidden}\n\n.dcJyB_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.dcJyB_eIAv{display:flex;position:relative}\n\n.dcJyB_ePHw{flex-basis:91%;overflow:hidden;padding-bottom:10px;text-overflow:ellipsis;white-space:nowrap}\n\n.dcJyB_dzsH{overflow:visible;text-overflow:unset;white-space:normal}\n\n.dcJyB_byoJ{position:absolute;right:7px;top:-8px}\n\n.dcJyB_evBt{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}\n\n.dcJyB_pAQb{display:flex;flex-direction:column;height:60px}\n\n.dcJyB_zefc{display:flex;flex-basis:55%;justify-content:flex-end}\n\n.dcJyB_dPzc{flex-direction:column}\n\n.dcJyB_dPzc,.dcJyB_dzph{display:flex;flex-basis:100%}\n\n.dcJyB_dzph{align-items:flex-start;box-sizing:border-box;column-gap:5px;justify-content:space-between;padding:0 30px 0 25px}\n\n.dcJyB_eobd{padding-top:1rem}\n\n.dcJyB_NpIG{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n@media screen and (--tabletBreakPoint){.dcJyB_zefc{flex-basis:100%;justify-content:flex-start}.dcJyB_ePHw{flex-basis:94%}.dcJyB_eDnN{flex-basis:100%}.dcJyB_dzph{padding:0}.dcJyB_eDnN h3{padding-right:30px}.dcJyB_NpIG{right:17px}.dcJyB_eIAv{margin-bottom:20px}.dcJyB_byoJ{right:-7px}.dcJyB_dzph{flex-wrap:wrap}}");
|
|
15
|
+
},
|
|
16
|
+
'heading': 'dcJyB_eDnN',
|
|
17
|
+
'cardWrapper': 'dcJyB_eKXQ',
|
|
18
|
+
'bodyPresentation': 'dcJyB_eIAv',
|
|
19
|
+
'bodyExcerpt': 'dcJyB_ePHw',
|
|
20
|
+
'bodyExcerptExpanded': 'dcJyB_dzsH',
|
|
21
|
+
'bodyExpandButtonWrapper': 'dcJyB_byoJ',
|
|
22
|
+
'innerWrapper': 'dcJyB_evBt',
|
|
23
|
+
'expandableInnerWrapper': 'dcJyB_pAQb',
|
|
24
|
+
'metricsWithControls': 'dcJyB_zefc',
|
|
25
|
+
'metricGroup': 'dcJyB_dPzc',
|
|
26
|
+
'metricsRow': 'dcJyB_dzph',
|
|
27
|
+
'metricsRowPaginated': 'dcJyB_eobd',
|
|
28
|
+
'itemCardToggleButtonWrapper': 'dcJyB_NpIG'
|
|
29
|
+
};
|
|
30
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
31
|
+
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
32
|
+
import { Text } from '@instructure/ui-text';
|
|
33
|
+
import { themeable } from '@instructure/ui-themeable';
|
|
34
|
+
import theme from "./theme.js";
|
|
35
|
+
import { difficultyIndex, discriminationIndex, pearsonCorrelation } from "./popoverContent.js";
|
|
36
|
+
import Card from "../../../../../common/components/shared/Card/index.js";
|
|
37
|
+
import AnalysisMetric from "../AnalysisMetric/index.js";
|
|
38
|
+
import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
|
|
39
|
+
import PropTypes from 'prop-types';
|
|
40
|
+
import classnames from 'classnames';
|
|
41
|
+
import { interactionTypesNameDictionary } from "../../../../../common/util/interactionTypeMetadata.js";
|
|
42
|
+
export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
43
|
+
_inherits(NewItemAnalysis, _Component);
|
|
44
|
+
|
|
45
|
+
var _super = _createSuper(NewItemAnalysis);
|
|
46
|
+
|
|
47
|
+
function NewItemAnalysis() {
|
|
48
|
+
var _this;
|
|
49
|
+
|
|
50
|
+
_classCallCheck(this, NewItemAnalysis);
|
|
51
|
+
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
args[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
57
|
+
_this.state = {
|
|
58
|
+
bodyToggable: false,
|
|
59
|
+
bodyExpanded: false,
|
|
60
|
+
itemExpanded: false,
|
|
61
|
+
metricsExpanded: false
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
_this.mapInteractionTypeToTranslation = function (interactionType) {
|
|
65
|
+
return interactionTypesNameDictionary({
|
|
66
|
+
slug: interactionType,
|
|
67
|
+
name: t('Question')
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this.buildItemCardHeadingId = function () {
|
|
72
|
+
return "itemCardHeading-".concat(_this.props.itemAnalysis.metadata.item_id);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
_this.buildItemCardBodyId = function () {
|
|
76
|
+
return "itemCardBody-".concat(_this.props.itemAnalysis.metadata.item_id);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
_this.bodyExceedsLimit = function (bodyElement, headingElement) {
|
|
80
|
+
if (!bodyElement || !headingElement) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return bodyElement.scrollWidth > headingElement.clientWidth || _this.state.bodyExpanded;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
_this.handleBodyWidth = function () {
|
|
88
|
+
var bodyElement = document.getElementById(_this.buildItemCardBodyId());
|
|
89
|
+
var headingElement = document.getElementById(_this.buildItemCardHeadingId());
|
|
90
|
+
|
|
91
|
+
_this.setState({
|
|
92
|
+
bodyToggable: _this.bodyExceedsLimit(bodyElement, headingElement)
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
_this.handleToggle = function () {
|
|
97
|
+
_this.setState({
|
|
98
|
+
metricsExpanded: !_this.state.metricsExpanded
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
_this.setState({
|
|
102
|
+
itemExpanded: !_this.state.itemExpanded
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_this.handleBodyToggle = function () {
|
|
107
|
+
_this.setState({
|
|
108
|
+
bodyExpanded: !_this.state.bodyExpanded
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_this.renderExpandItemCardButton = function () {
|
|
113
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: styles.itemCardToggleButtonWrapper
|
|
115
|
+
}, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
116
|
+
onClick: _this.handleToggle,
|
|
117
|
+
title: _this.state.metricsExpanded ? t('collapse item card') : t('expand item card'),
|
|
118
|
+
isExpanded: _this.state.metricsExpanded
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
_this.renderBodyToggleButton = function () {
|
|
123
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
className: styles.bodyExpandButtonWrapper
|
|
125
|
+
}, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
126
|
+
onClick: _this.handleBodyToggle,
|
|
127
|
+
title: _this.state.bodyExpanded ? t('collapse question stem') : t('expand question stem'),
|
|
128
|
+
isExpanded: _this.state.bodyExpanded
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
_this.renderExpanded = function () {
|
|
133
|
+
var scores = _this.props.itemAnalysis.scores;
|
|
134
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: [styles.metricsRow, styles.metricsRowPaginated].join(' ')
|
|
136
|
+
}, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
137
|
+
metricKey: "pearson_correlation",
|
|
138
|
+
label: t('Pearson Correlation Coefficient'),
|
|
139
|
+
value: t.number(scores.pearson_correlation),
|
|
140
|
+
popoverDescription: pearsonCorrelation
|
|
141
|
+
}));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return _this;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_createClass(NewItemAnalysis, [{
|
|
148
|
+
key: "componentDidMount",
|
|
149
|
+
value: function componentDidMount() {
|
|
150
|
+
this.handleBodyWidth();
|
|
151
|
+
window.addEventListener('resize', this.handleBodyWidth);
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "componentWillUnmount",
|
|
155
|
+
value: function componentWillUnmount() {
|
|
156
|
+
window.removeEventListener('resize', this.handleBodyWidth);
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "render",
|
|
160
|
+
value: function render() {
|
|
161
|
+
var _this$props$itemAnaly = this.props.itemAnalysis,
|
|
162
|
+
metadata = _this$props$itemAnaly.metadata,
|
|
163
|
+
scores = _this$props$itemAnaly.scores;
|
|
164
|
+
var bodyClass = classnames(styles.bodyExcerpt, _defineProperty({}, styles.bodyExcerptExpanded, this.state.bodyExpanded));
|
|
165
|
+
var headingId = this.buildItemCardHeadingId();
|
|
166
|
+
var bodyId = this.buildItemCardBodyId();
|
|
167
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
168
|
+
className: styles.cardWrapper
|
|
169
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
className: styles.innerWrapper
|
|
171
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
id: headingId,
|
|
173
|
+
className: styles.heading
|
|
174
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
175
|
+
margin: "0 0 small 0",
|
|
176
|
+
level: "h3",
|
|
177
|
+
weight: "bold",
|
|
178
|
+
color: "primary"
|
|
179
|
+
}, metadata.item_title), /*#__PURE__*/React.createElement(Text, {
|
|
180
|
+
size: "small",
|
|
181
|
+
weight: "bold",
|
|
182
|
+
transform: "capitalize"
|
|
183
|
+
}, this.mapInteractionTypeToTranslation(metadata.interaction_type)), /*#__PURE__*/React.createElement("div", {
|
|
184
|
+
id: "itemBody",
|
|
185
|
+
className: styles.bodyPresentation
|
|
186
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
id: bodyId,
|
|
188
|
+
className: bodyClass
|
|
189
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
190
|
+
size: "small"
|
|
191
|
+
}, metadata.item_body)), this.state.bodyToggable && this.renderBodyToggleButton())), /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: styles.metricsWithControls
|
|
193
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
className: styles.metricGroup
|
|
195
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: styles.metricsRow
|
|
197
|
+
}, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
198
|
+
metricKey: "difficulty_index",
|
|
199
|
+
label: t('Item Difficulty'),
|
|
200
|
+
value: t.number(scores.difficulty_index),
|
|
201
|
+
popoverDescription: difficultyIndex
|
|
202
|
+
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
203
|
+
metricKey: "mean",
|
|
204
|
+
label: t('Mean Earned Points'),
|
|
205
|
+
value: t.number(scores.mean)
|
|
206
|
+
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
207
|
+
metricKey: "median",
|
|
208
|
+
label: t('Median Earned Points'),
|
|
209
|
+
value: t.number(scores.median)
|
|
210
|
+
}), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
211
|
+
metricKey: "discrimination_index",
|
|
212
|
+
label: t('Discrimination Index'),
|
|
213
|
+
value: t.number(scores.discrimination_index),
|
|
214
|
+
popoverDescription: discriminationIndex
|
|
215
|
+
}), this.renderExpandItemCardButton()), this.state.metricsExpanded && this.renderExpanded()))), this.state.itemExpanded && /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: styles.expandableInnerWrapper
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
}]);
|
|
220
|
+
|
|
221
|
+
NewItemAnalysis.displayName = "NewItemAnalysis";
|
|
222
|
+
return NewItemAnalysis;
|
|
223
|
+
}(Component), _class2.propTypes = {
|
|
224
|
+
itemAnalysis: PropTypes.shape({
|
|
225
|
+
attempts: PropTypes.shape({
|
|
226
|
+
students_responded: PropTypes.number,
|
|
227
|
+
students_without_response: PropTypes.number
|
|
228
|
+
}),
|
|
229
|
+
metadata: PropTypes.shape({
|
|
230
|
+
interaction_type: PropTypes.string,
|
|
231
|
+
item_body: PropTypes.string,
|
|
232
|
+
item_id: PropTypes.string,
|
|
233
|
+
item_title: PropTypes.string
|
|
234
|
+
}),
|
|
235
|
+
scores: PropTypes.shape({
|
|
236
|
+
difficulty_index: PropTypes.number,
|
|
237
|
+
discrimination_index: PropTypes.number,
|
|
238
|
+
mean: PropTypes.number,
|
|
239
|
+
median: PropTypes.number,
|
|
240
|
+
pearson_correlation: PropTypes.number,
|
|
241
|
+
points_possible: PropTypes.number,
|
|
242
|
+
quartile_distribution: PropTypes.arrayOf(PropTypes.number)
|
|
243
|
+
})
|
|
244
|
+
}).isRequired
|
|
245
|
+
}, _temp)) || _class);
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -6,42 +6,37 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
8
|
import { Heading } from '@instructure/ui-heading';
|
|
9
|
-
import { Metric } from '@instructure/ui-metric';
|
|
10
9
|
import React, { Component } from 'react';
|
|
11
10
|
var styles = {
|
|
12
|
-
componentId: '
|
|
11
|
+
componentId: 'ePPpE',
|
|
13
12
|
template: function template(theme) {
|
|
14
|
-
return "\n\n.
|
|
13
|
+
return "\n\n.ePPpE_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.ePPpE_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.ePPpE_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.ePPpE_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.ePPpE_dPzc,.ePPpE_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}\n\n.ePPpE_dPzc{margin-left:-8px}");
|
|
15
14
|
},
|
|
16
|
-
'heading': '
|
|
17
|
-
'cardWrapper': '
|
|
18
|
-
'container': '
|
|
19
|
-
'
|
|
20
|
-
'metricGroup': '
|
|
21
|
-
'metricsWrapper': '
|
|
22
|
-
'popoverContainer': 'bsfUh_dqHR',
|
|
23
|
-
'expandButtonContainer': 'bsfUh_bTHH'
|
|
15
|
+
'heading': 'ePPpE_eDnN',
|
|
16
|
+
'cardWrapper': 'ePPpE_eKXQ',
|
|
17
|
+
'container': 'ePPpE_crZr',
|
|
18
|
+
'expandButtonContainer': 'ePPpE_bTHH',
|
|
19
|
+
'metricGroup': 'ePPpE_dPzc',
|
|
20
|
+
'metricsWrapper': 'ePPpE_cpZE'
|
|
24
21
|
};
|
|
25
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
26
23
|
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
27
24
|
import { Text } from '@instructure/ui-text';
|
|
28
25
|
import { themeable } from '@instructure/ui-themeable';
|
|
29
26
|
import theme from "./theme.js";
|
|
30
|
-
import { getSanitizedMetricValue } from "../utils.js";
|
|
31
|
-
import MetricPopover from "../MetricPopover/index.js";
|
|
32
27
|
import { formatTimeToFullNumeric } from "../../../../../common/util/formatTimespan.js";
|
|
33
28
|
import PropTypes from 'prop-types';
|
|
34
29
|
import Card from "../../../../../common/components/shared/Card/index.js";
|
|
30
|
+
import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
|
|
31
|
+
import AnalysisMetric from "../AnalysisMetric/index.js";
|
|
35
32
|
import { ScoreDistribution } from "../charts/ScoreDistribution/presenter.js";
|
|
36
33
|
var stdDevPopoverTexts = {
|
|
37
|
-
metricLabel: 'standard deviation',
|
|
38
34
|
title: 'Lorem ipsum ',
|
|
39
35
|
subtitle: 'subtitle',
|
|
40
36
|
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor',
|
|
41
37
|
screenReaderLabel: 'standard deviation tooltip'
|
|
42
38
|
};
|
|
43
39
|
var cronbachsAlphaPopoverTexts = {
|
|
44
|
-
metricLabel: 'cronbach\'s alpha',
|
|
45
40
|
title: 'Lorem ipsum ',
|
|
46
41
|
subtitle: 'subtitle',
|
|
47
42
|
body: 'cronbach\'s alpha description',
|
|
@@ -81,50 +76,28 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
81
76
|
className: styles.container
|
|
82
77
|
}, /*#__PURE__*/React.createElement("div", {
|
|
83
78
|
className: styles.metricGroup
|
|
84
|
-
},
|
|
79
|
+
}, /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
80
|
+
metricKey: "median_percentage",
|
|
81
|
+
label: t('Median Score'),
|
|
82
|
+
value: t.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
|
|
83
|
+
suffix: "%"
|
|
84
|
+
}), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
85
|
+
metricKey: "stddev",
|
|
86
|
+
value: t.number(scores === null || scores === void 0 ? void 0 : scores.stddev),
|
|
87
|
+
label: t('Standard Deviation'),
|
|
88
|
+
popoverDescription: stdDevPopoverTexts
|
|
89
|
+
}), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
90
|
+
metricKey: "cronbachs_alpha",
|
|
91
|
+
value: t.number(scores === null || scores === void 0 ? void 0 : scores.cronbachs_alpha),
|
|
92
|
+
label: t('Cronbach\'s Alpha'),
|
|
93
|
+
popoverDescription: cronbachsAlphaPopoverTexts
|
|
94
|
+
})));
|
|
85
95
|
};
|
|
86
96
|
|
|
87
97
|
return _this;
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
_createClass(NewQuizAnalysis, [{
|
|
91
|
-
key: "renderLabelWithPopover",
|
|
92
|
-
value: function renderLabelWithPopover(texts) {
|
|
93
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
94
|
-
className: styles.metricLabel
|
|
95
|
-
}, texts.metricLabel, /*#__PURE__*/React.createElement("span", {
|
|
96
|
-
className: styles.popoverContainer
|
|
97
|
-
}, /*#__PURE__*/React.createElement(MetricPopover, texts)));
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
key: "renderMetric",
|
|
101
|
-
value: function renderMetric(key, label, value, suffix) {
|
|
102
|
-
return /*#__PURE__*/React.createElement(Metric, {
|
|
103
|
-
theme: {
|
|
104
|
-
valueFontWeight: 500
|
|
105
|
-
},
|
|
106
|
-
textAlign: "start",
|
|
107
|
-
key: key,
|
|
108
|
-
renderLabel: /*#__PURE__*/React.createElement("span", {
|
|
109
|
-
className: styles.metricLabel
|
|
110
|
-
}, label),
|
|
111
|
-
renderValue: getSanitizedMetricValue(value, suffix)
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "renderMetricWithPopover",
|
|
116
|
-
value: function renderMetricWithPopover(key, texts, value) {
|
|
117
|
-
return /*#__PURE__*/React.createElement(Metric, {
|
|
118
|
-
theme: {
|
|
119
|
-
valueFontWeight: 500
|
|
120
|
-
},
|
|
121
|
-
textAlign: "start",
|
|
122
|
-
key: key,
|
|
123
|
-
renderLabel: this.renderLabelWithPopover(texts),
|
|
124
|
-
renderValue: getSanitizedMetricValue(value)
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}, {
|
|
128
101
|
key: "render",
|
|
129
102
|
value: function render() {
|
|
130
103
|
var quizAnalysis = this.props.quizAnalysis;
|
|
@@ -143,9 +116,32 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
143
116
|
className: styles.metricGroup
|
|
144
117
|
}, /*#__PURE__*/React.createElement("div", {
|
|
145
118
|
className: styles.metricsWrapper
|
|
146
|
-
},
|
|
119
|
+
}, /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
120
|
+
metricKey: "highscore",
|
|
121
|
+
label: t('high score'),
|
|
122
|
+
value: scores === null || scores === void 0 ? void 0 : scores.max_percentage,
|
|
123
|
+
suffix: "%"
|
|
124
|
+
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
125
|
+
metricKey: "lowscore",
|
|
126
|
+
label: t('low score'),
|
|
127
|
+
value: scores === null || scores === void 0 ? void 0 : scores.min_percentage,
|
|
128
|
+
suffix: "%"
|
|
129
|
+
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
130
|
+
metricKey: "meanscore",
|
|
131
|
+
label: t('mean score'),
|
|
132
|
+
value: scores === null || scores === void 0 ? void 0 : scores.mean_percentage,
|
|
133
|
+
suffix: "%"
|
|
134
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
147
135
|
className: styles.metricsWrapper
|
|
148
|
-
},
|
|
136
|
+
}, /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
137
|
+
metricKey: "average_attempts",
|
|
138
|
+
label: t('average attempts'),
|
|
139
|
+
value: t.number(attempts === null || attempts === void 0 ? void 0 : attempts.average_attempts)
|
|
140
|
+
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
141
|
+
metricKey: "mean_elapsed_sec",
|
|
142
|
+
label: t('mean elapsed time'),
|
|
143
|
+
value: formatTimeToFullNumeric(attempts === null || attempts === void 0 ? void 0 : attempts.mean_elapsed_sec)
|
|
144
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
149
145
|
className: styles.expandButtonContainer
|
|
150
146
|
}, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
151
147
|
onClick: this.handleToggle,
|
|
@@ -163,10 +159,10 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
163
159
|
return NewQuizAnalysis;
|
|
164
160
|
}(Component), _class2.propTypes = {
|
|
165
161
|
quizAnalysis: PropTypes.shape({
|
|
166
|
-
created_timestamp: PropTypes.string,
|
|
162
|
+
created_timestamp: PropTypes.string.isRequired,
|
|
167
163
|
metadata: PropTypes.shape({
|
|
168
164
|
quiz_title: PropTypes.string
|
|
169
|
-
}),
|
|
165
|
+
}).isRequired,
|
|
170
166
|
scores: PropTypes.shape({
|
|
171
167
|
decile_distribution: PropTypes.arrayOf(PropTypes.number),
|
|
172
168
|
cronbachs_alpha: PropTypes.number,
|
|
@@ -184,4 +180,6 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
184
180
|
average_attempts: PropTypes.number
|
|
185
181
|
}).isRequired
|
|
186
182
|
}).isRequired
|
|
183
|
+
}, _class2.defaultProps = {
|
|
184
|
+
quizAnalysis: {}
|
|
187
185
|
}, _temp)) || _class);
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { Heading } from '@instructure/ui-heading';
|
|
7
|
-
import
|
|
7
|
+
import NewItemAnalysis from "./NewItemAnalysis/index.js";
|
|
8
8
|
import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
|
|
9
9
|
import NewQuizAnalysis from "./NewQuizAnalysis/index.js";
|
|
10
10
|
|
|
@@ -106,21 +106,10 @@ export var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
|
|
|
106
106
|
return /*#__PURE__*/React.createElement("div", {
|
|
107
107
|
className: "fs-mask"
|
|
108
108
|
}, _ref4, _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
109
|
-
return /*#__PURE__*/React.createElement(
|
|
110
|
-
key: itemAnalysis.metadata.item_id
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
renderLabel: "ITEM DIFFICULTY",
|
|
114
|
-
renderValue: itemAnalysis.scores.difficulty_index
|
|
115
|
-
}), /*#__PURE__*/React.createElement(Metric, {
|
|
116
|
-
key: "responded",
|
|
117
|
-
renderLabel: "RESPONDED",
|
|
118
|
-
renderValue: itemAnalysis.attempts.students_responded
|
|
119
|
-
}), /*#__PURE__*/React.createElement(Metric, {
|
|
120
|
-
key: "skipped",
|
|
121
|
-
renderLabel: "SKIPPED/NO RESPONSE",
|
|
122
|
-
renderValue: itemAnalysis.attempts.students_without_response
|
|
123
|
-
}));
|
|
109
|
+
return /*#__PURE__*/React.createElement(NewItemAnalysis, {
|
|
110
|
+
key: itemAnalysis.metadata.item_id,
|
|
111
|
+
itemAnalysis: itemAnalysis
|
|
112
|
+
});
|
|
124
113
|
}));
|
|
125
114
|
/* eslint-enable react/jsx-no-literals */
|
|
126
115
|
}; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
|
package/lib/banks/api/banks.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getExistingBankAndEntries = getExistingBankAndEntries;
|
|
9
|
-
exports.updateSharedBankPermission = exports.getSharedBanks = exports.shareBank = exports.deleteBank = exports.updateBank = exports.createBank = exports.getBank = exports.getAllBanks = exports.getBanks = void 0;
|
|
9
|
+
exports.updateSharedBankPermission = exports.getSharedBanks = exports.getSharedBank = exports.shareBank = exports.deleteBank = exports.updateBank = exports.createBank = exports.getBank = exports.getAllBanks = exports.getBanks = void 0;
|
|
10
10
|
|
|
11
11
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
12
|
|
|
@@ -34,6 +34,8 @@ var _helpers = require("../../common/api/helpers.js");
|
|
|
34
34
|
|
|
35
35
|
var _quizCommon = require("@instructure/quiz-common");
|
|
36
36
|
|
|
37
|
+
var _lodash = require("lodash");
|
|
38
|
+
|
|
37
39
|
var banksApiEndpoint = '/api/banks';
|
|
38
40
|
var DEFAULT_PAGE_SIZE = 100;
|
|
39
41
|
|
|
@@ -211,7 +213,8 @@ var deleteBank = function deleteBank(bankId) {
|
|
|
211
213
|
|
|
212
214
|
exports.deleteBank = deleteBank;
|
|
213
215
|
|
|
214
|
-
var shareBank = function shareBank(_shareBank
|
|
216
|
+
var shareBank = function shareBank(_shareBank) {
|
|
217
|
+
var getUserInfo = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _lodash.noop;
|
|
215
218
|
var url = "".concat(banksApiEndpoint, "/").concat(_shareBank.bankId, "/shared_banks");
|
|
216
219
|
return function (dispatch, getState) {
|
|
217
220
|
var shareBankData = JSON.stringify({
|
|
@@ -258,6 +261,41 @@ var shareBank = function shareBank(_shareBank, getUserInfo) {
|
|
|
258
261
|
|
|
259
262
|
exports.shareBank = shareBank;
|
|
260
263
|
|
|
264
|
+
var getSharedBank = function getSharedBank(bankId, entityType, entityId) {
|
|
265
|
+
var url = "".concat(banksApiEndpoint, "/").concat(bankId, "/shared_banks");
|
|
266
|
+
var params = {
|
|
267
|
+
entity_type: entityType,
|
|
268
|
+
entity_id: entityId
|
|
269
|
+
};
|
|
270
|
+
return function (dispatch, getState) {
|
|
271
|
+
var fetcher = new _Fetcher.default({
|
|
272
|
+
onError: (0, _helpers.handleError)(dispatch, (0, _formatMessage.default)('Failed to fetch shared bank.'))
|
|
273
|
+
});
|
|
274
|
+
return fetcher.get(url, params).then(function (sharedBankInfo) {
|
|
275
|
+
// if the API returns no data, we manually add placeholder to the response
|
|
276
|
+
if (sharedBankInfo.length === 0) {
|
|
277
|
+
var placeholder = {
|
|
278
|
+
id: "notshared_".concat(bankId, "_").concat(entityId),
|
|
279
|
+
entityType: entityType,
|
|
280
|
+
entityId: entityId,
|
|
281
|
+
permission: _quizCommon.REMOVED_ACCESS,
|
|
282
|
+
bankId: bankId
|
|
283
|
+
};
|
|
284
|
+
sharedBankInfo.push(placeholder);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
dispatch((0, _callHandlers.handleShareBanksResponse)(sharedBankInfo));
|
|
288
|
+
}).catch(function (err) {
|
|
289
|
+
if (err.response.status === 401) {
|
|
290
|
+
dispatch((0, _ui.clear)(_quizCommon.BANKS_BANK_PAGINATION));
|
|
291
|
+
throw err;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
exports.getSharedBank = getSharedBank;
|
|
298
|
+
|
|
261
299
|
var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
262
300
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id, "/shared_banks");
|
|
263
301
|
var userSharedBanks = [];
|
|
@@ -7,6 +7,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
+
exports.mapStateToProps = mapStateToProps;
|
|
10
11
|
exports.default = exports.Bank = void 0;
|
|
11
12
|
|
|
12
13
|
var immutable = _interopRequireWildcard(require("immutable"));
|
|
@@ -33,11 +34,16 @@ var _alerts = require("../../../common/actions/alerts.js");
|
|
|
33
34
|
|
|
34
35
|
var _bankSearch = require("../../../common/actions/bankSearch.js");
|
|
35
36
|
|
|
37
|
+
var _sharedBanks = require("../../../common/actions/sharedBanks.js");
|
|
38
|
+
|
|
36
39
|
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
37
40
|
|
|
38
41
|
function mapStateToProps(state, props) {
|
|
39
42
|
var bank = new _Bank.default(state.getIn(['banks', props.bankId]));
|
|
40
43
|
var search = state.get('bankSearch', immutable.Map());
|
|
44
|
+
var courseSharedBank = state.get('sharedBanks', immutable.Map()).find(function (sharedBank) {
|
|
45
|
+
return sharedBank.get('bankId') === props.bankId && sharedBank.get('entityType') === props.scope.type && sharedBank.get('entityId') === props.scope.uuid;
|
|
46
|
+
});
|
|
41
47
|
var activeQuiz = (0, _quizzes.getActiveQuiz)(state);
|
|
42
48
|
var lockBlueprintContentEnabled = (0, _featureCheck.featureOn)('lock_blueprint_content');
|
|
43
49
|
var isQuizContentLocked = activeQuiz && activeQuiz.originalQuizLockedByBlueprint && lockBlueprintContentEnabled;
|
|
@@ -45,10 +51,12 @@ function mapStateToProps(state, props) {
|
|
|
45
51
|
bank: bank,
|
|
46
52
|
isQuizContentLocked: isQuizContentLocked,
|
|
47
53
|
search: search,
|
|
54
|
+
courseSharedBank: courseSharedBank,
|
|
48
55
|
useBankSearch: (0, _featureCheck.featureOn)('item_bank_search'),
|
|
49
56
|
position: state.getIn(['ui', _quizCommon.BUILD_TRAY_POSITION]),
|
|
50
57
|
stimulusId: state.getIn(['ui', _quizCommon.BUILD_TRAY_STIMULUS_ID]),
|
|
51
|
-
activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
|
|
58
|
+
activeQuizId: state.getIn(['quizzes', 'activeQuizId']),
|
|
59
|
+
showShareBankFromTray: (0, _featureCheck.featureOn)('share_bank_from_tray')
|
|
52
60
|
};
|
|
53
61
|
}
|
|
54
62
|
|
|
@@ -56,9 +64,14 @@ var mapDispatchToProps = {
|
|
|
56
64
|
addEntryToQuiz: _quizEntries.createQuizEntry,
|
|
57
65
|
getBank: _banks.getBank,
|
|
58
66
|
getBankEntries: _bankEntries.getBankEntries,
|
|
67
|
+
getSharedBank: _banks.getSharedBank,
|
|
59
68
|
openModal: _modal.openModal,
|
|
69
|
+
removeSharedBank: _sharedBanks.removeSharedBank,
|
|
60
70
|
resetSearch: _bankSearch.reset,
|
|
61
|
-
screenreaderNotification: _alerts.screenreaderNotification
|
|
71
|
+
screenreaderNotification: _alerts.screenreaderNotification,
|
|
72
|
+
shareBank: _banks.shareBank,
|
|
73
|
+
updateSharedBankPermission: _banks.updateSharedBankPermission,
|
|
74
|
+
withConfirm: _modal.withConfirm
|
|
62
75
|
};
|
|
63
76
|
var Bank = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.Bank);
|
|
64
77
|
exports.Bank = Bank;
|