@instructure/quiz-core 17.61.1-rc.0 → 17.62.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.
Files changed (20) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +2 -22
  3. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +1 -1
  4. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +3 -119
  5. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +119 -0
  6. package/es/reporting/components/resources/NewQuizAndItemAnalysis/index.js +3 -11
  7. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +28 -93
  8. package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +22 -1
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +27 -0
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +202 -0
  11. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +3 -23
  12. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +1 -1
  13. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +3 -134
  14. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +146 -0
  15. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/index.js +4 -14
  16. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +36 -102
  17. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +27 -3
  18. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +45 -0
  19. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +220 -0
  20. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [17.62.0](https://gerrit.instructure.com/quizzes-ui/compare/v17.61.0...v17.62.0) (2023-08-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **reporting:** Align report cards to the new layout ([85ca56d](https://gerrit.instructure.com/quizzes-ui/commits/85ca56d8f87774404dcab22d0a5565ceb1caeaaa))
12
+ * **Reports:** Introduce common component for item analysis ([6f2ff86](https://gerrit.instructure.com/quizzes-ui/commits/6f2ff8632f00893795b7cd725f65a6299d5e3f49))
13
+
14
+
15
+
16
+
17
+
6
18
  # [17.61.0](https://gerrit.instructure.com/quizzes-ui/compare/v17.60.0...v17.61.0) (2023-08-01)
7
19
 
8
20
 
@@ -37,9 +37,9 @@ import { difficultyIndex, discriminationIndex, pearsonCorrelation } from "./popo
37
37
  import Card from "../../../../../common/components/shared/Card/index.js";
38
38
  import AnalysisMetric from "../AnalysisMetric/index.js";
39
39
  import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
40
- import PropTypes from 'prop-types';
41
40
  import classnames from 'classnames';
42
41
  import { interactionTypesNameDictionary } from "../../../../../common/util/interactionTypeMetadata.js";
42
+ import { itemAnalysisPropType } from "../propTypes.js";
43
43
  export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
44
44
  _inherits(NewItemAnalysis, _Component);
45
45
 
@@ -238,25 +238,5 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
238
238
  NewItemAnalysis.displayName = "NewItemAnalysis";
239
239
  return NewItemAnalysis;
240
240
  }(Component), _class2.propTypes = {
241
- itemAnalysis: PropTypes.shape({
242
- attempts: PropTypes.shape({
243
- students_responded: PropTypes.number,
244
- students_without_response: PropTypes.number
245
- }),
246
- metadata: PropTypes.shape({
247
- interaction_type: PropTypes.string,
248
- item_body: PropTypes.string,
249
- item_id: PropTypes.string,
250
- item_title: PropTypes.string
251
- }),
252
- scores: PropTypes.shape({
253
- difficulty_index: PropTypes.number,
254
- discrimination_index: PropTypes.number,
255
- mean: PropTypes.number,
256
- median: PropTypes.number,
257
- pearson_correlation: PropTypes.number,
258
- points_possible: PropTypes.number,
259
- quartile_distribution: PropTypes.arrayOf(PropTypes.number)
260
- })
261
- }).isRequired
241
+ itemAnalysis: itemAnalysisPropType.isRequired
262
242
  }, _temp)) || _class);
@@ -152,7 +152,7 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
152
152
  NewQuizAnalysis.displayName = "NewQuizAnalysis";
153
153
  return NewQuizAnalysis;
154
154
  }(Component), _class2.propTypes = {
155
- quizAnalysis: quizAnalysisPropType
155
+ quizAnalysis: quizAnalysisPropType.isRequired
156
156
  }, _class2.defaultProps = {
157
157
  quizAnalysis: {}
158
158
  }, _temp)) || _class);
@@ -1,120 +1,4 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
-
6
- var _dec, _class, _class2, _temp;
7
-
8
- import React, { Component } from 'react';
9
- import PropTypes from 'prop-types';
10
- import t from '@instructure/quiz-i18n/es/format-message';
11
- import { Text } from '@instructure/ui-text';
12
- import { Link } from '@instructure/ui-link';
13
- import { Flex } from '@instructure/ui-flex';
14
- import { themeable } from '@instructure/ui-themeable';
15
- import Card from "../../../../../common/components/shared/Card/index.js";
16
- var styles = {
17
- componentId: 'eJSiT',
18
- template: function template(theme) {
19
- return "\n\n.eJSiT_bqdH{column-gap:5px;display:flex;justify-content:space-between;padding:".concat(theme.metricsPadding || 'inherit', " 0}\n\n.eJSiT_fbIL{border-radius:").concat(theme.cardBorderRadius || 'inherit', ";box-shadow:").concat(theme.cardBoxShadow || 'inherit', ";display:inline-flex;flex-direction:column;margin:").concat(theme.cardMargin || 'inherit', ";padding:").concat(theme.cardPadding || 'inherit', ";width:").concat(theme.cardWidth || 'inherit', "}\n\n.eJSiT_blRb{max-width:160px;padding-right:10px}");
20
- },
21
- 'metricsContainer': 'eJSiT_bqdH',
22
- 'card': 'eJSiT_fbIL',
23
- 'dateContainer': 'eJSiT_blRb'
24
- };
25
- import theme from "./theme.js";
26
- import AnalysisMetric from "../AnalysisMetric/index.js";
27
- import Spinner from "../../../../../common/components/shared/spinner/Spinner.js";
28
- import { AnalysisUpdateDate } from "../AnalysisUpdateDate/index.js";
29
- import { quizAnalysisPropType } from "../propTypes.js";
30
-
31
- var _ref = /*#__PURE__*/React.createElement(Spinner, null);
32
-
33
- export var NewQuizAndItemAnalysisReportCard = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
34
- _inherits(NewQuizAndItemAnalysisReportCard, _Component);
35
-
36
- var _super = _createSuper(NewQuizAndItemAnalysisReportCard);
37
-
38
- function NewQuizAndItemAnalysisReportCard() {
39
- var _this;
40
-
41
- _classCallCheck(this, NewQuizAndItemAnalysisReportCard);
42
-
43
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
- args[_key] = arguments[_key];
45
- }
46
-
47
- _this = _super.call.apply(_super, [this].concat(args));
48
-
49
- _this.renderMetrics = function () {
50
- var _quizAnalysis$scores, _quizAnalysis$scores2, _quizAnalysis$scores3;
51
-
52
- var quizAnalysis = _this.props.quizAnalysis;
53
- return /*#__PURE__*/React.createElement("div", {
54
- className: styles.metricsContainer
55
- }, /*#__PURE__*/React.createElement(AnalysisMetric, {
56
- metricKey: "highscore",
57
- label: t('high score'),
58
- value: (_quizAnalysis$scores = quizAnalysis.scores) === null || _quizAnalysis$scores === void 0 ? void 0 : _quizAnalysis$scores.max_percentage,
59
- suffix: "%"
60
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
61
- metricKey: "lowscore",
62
- label: t('low score'),
63
- value: (_quizAnalysis$scores2 = quizAnalysis.scores) === null || _quizAnalysis$scores2 === void 0 ? void 0 : _quizAnalysis$scores2.min_percentage,
64
- suffix: "%"
65
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
66
- metricKey: "meanscore",
67
- label: t('mean score'),
68
- value: (_quizAnalysis$scores3 = quizAnalysis.scores) === null || _quizAnalysis$scores3 === void 0 ? void 0 : _quizAnalysis$scores3.mean_percentage,
69
- suffix: "%"
70
- }));
71
- };
72
-
73
- return _this;
74
- }
75
-
76
- _createClass(NewQuizAndItemAnalysisReportCard, [{
77
- key: "renderContent",
78
- value: function renderContent() {
79
- var _this$props = this.props,
80
- name = _this$props.name,
81
- href = _this$props.href,
82
- quizAnalysis = _this$props.quizAnalysis;
83
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
84
- size: "medium",
85
- weight: "bold"
86
- }, name), this.renderMetrics(), /*#__PURE__*/React.createElement(Flex, {
87
- direction: "row",
88
- justifyItems: "space-between"
89
- }, /*#__PURE__*/React.createElement("div", {
90
- className: styles.dateContainer
91
- }, /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
92
- date: quizAnalysis.created_timestamp,
93
- multiline: true
94
- })), /*#__PURE__*/React.createElement(Link, {
95
- href: href
96
- }, /*#__PURE__*/React.createElement(Text, {
97
- size: "small"
98
- }, t('View Report')))));
99
- }
100
- }, {
101
- key: "render",
102
- value: function render() {
103
- return /*#__PURE__*/React.createElement(Card, {
104
- className: styles.card
105
- }, this.props.quizAnalysis ? this.renderContent() : _ref);
106
- }
107
- }]);
108
-
109
- NewQuizAndItemAnalysisReportCard.displayName = "NewQuizAndItemAnalysisReportCard";
110
- return NewQuizAndItemAnalysisReportCard;
111
- }(Component), _class2.propTypes = {
112
- name: PropTypes.node,
113
- href: PropTypes.string,
114
- quizAnalysis: quizAnalysisPropType
115
- }, _class2.defaultProps = {
116
- name: void 0,
117
- href: void 0,
118
- quizAnalysis: {}
119
- }, _temp)) || _class);
1
+ import { NewQuizAndItemAnalysisReportCardPresenter } from "./presenter.js";
2
+ import withAnalysisState from "../withAnalysisState.js";
3
+ export var NewQuizAndItemAnalysisReportCard = withAnalysisState(NewQuizAndItemAnalysisReportCardPresenter);
120
4
  export default NewQuizAndItemAnalysisReportCard;
@@ -0,0 +1,119 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+
6
+ var _dec, _class, _class2, _temp;
7
+
8
+ import React, { Component } from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import t from '@instructure/quiz-i18n/es/format-message';
11
+ import { Text } from '@instructure/ui-text';
12
+ import { Link } from '@instructure/ui-link';
13
+ import { Flex } from '@instructure/ui-flex';
14
+ import { themeable } from '@instructure/ui-themeable';
15
+ import Card from "../../../../../common/components/shared/Card/index.js";
16
+ var styles = {
17
+ componentId: 'eJSiT',
18
+ template: function template(theme) {
19
+ return "\n\n.eJSiT_bqdH{column-gap:5px;display:flex;justify-content:space-between;padding:".concat(theme.metricsPadding || 'inherit', " 0}\n\n.eJSiT_fbIL{border-radius:").concat(theme.cardBorderRadius || 'inherit', ";box-shadow:").concat(theme.cardBoxShadow || 'inherit', ";display:inline-flex;flex-direction:column;margin:").concat(theme.cardMargin || 'inherit', ";padding:").concat(theme.cardPadding || 'inherit', ";width:").concat(theme.cardWidth || 'inherit', "}\n\n.eJSiT_blRb{max-width:160px;padding-right:10px}");
20
+ },
21
+ 'metricsContainer': 'eJSiT_bqdH',
22
+ 'card': 'eJSiT_fbIL',
23
+ 'dateContainer': 'eJSiT_blRb'
24
+ };
25
+ import theme from "./theme.js";
26
+ import AnalysisMetric from "../AnalysisMetric/index.js";
27
+ import Spinner from "../../../../../common/components/shared/spinner/Spinner.js";
28
+ import { AnalysisUpdateDate } from "../AnalysisUpdateDate/index.js";
29
+ import { quizAnalysisPropType } from "../propTypes.js";
30
+
31
+ var _ref = /*#__PURE__*/React.createElement(Spinner, null);
32
+
33
+ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
34
+ _inherits(NewQuizAndItemAnalysisReportCardPresenter, _Component);
35
+
36
+ var _super = _createSuper(NewQuizAndItemAnalysisReportCardPresenter);
37
+
38
+ function NewQuizAndItemAnalysisReportCardPresenter() {
39
+ var _this;
40
+
41
+ _classCallCheck(this, NewQuizAndItemAnalysisReportCardPresenter);
42
+
43
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
+ args[_key] = arguments[_key];
45
+ }
46
+
47
+ _this = _super.call.apply(_super, [this].concat(args));
48
+
49
+ _this.renderMetrics = function () {
50
+ var _quizAnalysis$scores, _quizAnalysis$scores2, _quizAnalysis$scores3;
51
+
52
+ var quizAnalysis = _this.props.quizAnalysis;
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: styles.metricsContainer
55
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
56
+ metricKey: "highscore",
57
+ label: t('high score'),
58
+ value: (_quizAnalysis$scores = quizAnalysis.scores) === null || _quizAnalysis$scores === void 0 ? void 0 : _quizAnalysis$scores.max_percentage,
59
+ suffix: "%"
60
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
61
+ metricKey: "lowscore",
62
+ label: t('low score'),
63
+ value: (_quizAnalysis$scores2 = quizAnalysis.scores) === null || _quizAnalysis$scores2 === void 0 ? void 0 : _quizAnalysis$scores2.min_percentage,
64
+ suffix: "%"
65
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
66
+ metricKey: "meanscore",
67
+ label: t('mean score'),
68
+ value: (_quizAnalysis$scores3 = quizAnalysis.scores) === null || _quizAnalysis$scores3 === void 0 ? void 0 : _quizAnalysis$scores3.mean_percentage,
69
+ suffix: "%"
70
+ }));
71
+ };
72
+
73
+ return _this;
74
+ }
75
+
76
+ _createClass(NewQuizAndItemAnalysisReportCardPresenter, [{
77
+ key: "renderContent",
78
+ value: function renderContent() {
79
+ var _this$props = this.props,
80
+ name = _this$props.name,
81
+ href = _this$props.href,
82
+ quizAnalysis = _this$props.quizAnalysis;
83
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
84
+ size: "medium",
85
+ weight: "bold"
86
+ }, name), this.renderMetrics(), /*#__PURE__*/React.createElement(Flex, {
87
+ direction: "row",
88
+ justifyItems: "space-between"
89
+ }, /*#__PURE__*/React.createElement("div", {
90
+ className: styles.dateContainer
91
+ }, /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
92
+ date: quizAnalysis.created_timestamp,
93
+ multiline: true
94
+ })), /*#__PURE__*/React.createElement(Link, {
95
+ href: href
96
+ }, /*#__PURE__*/React.createElement(Text, {
97
+ size: "small"
98
+ }, t('View Report')))));
99
+ }
100
+ }, {
101
+ key: "render",
102
+ value: function render() {
103
+ return /*#__PURE__*/React.createElement(Card, {
104
+ className: styles.card
105
+ }, this.props.quizAnalysis ? this.renderContent() : _ref);
106
+ }
107
+ }]);
108
+
109
+ NewQuizAndItemAnalysisReportCardPresenter.displayName = "NewQuizAndItemAnalysisReportCardPresenter";
110
+ return NewQuizAndItemAnalysisReportCardPresenter;
111
+ }(Component), _class2.propTypes = {
112
+ name: PropTypes.node,
113
+ href: PropTypes.string,
114
+ quizAnalysis: quizAnalysisPropType
115
+ }, _class2.defaultProps = {
116
+ name: void 0,
117
+ href: void 0,
118
+ quizAnalysis: void 0
119
+ }, _temp)) || _class);
@@ -1,12 +1,4 @@
1
- import { NewQuizAndItemAnalysis as NewQuizAndItemAnalysisPresenter } from "./presenter.js";
2
- import { connect } from "../../../../common/react-redux.js";
3
- import { getQuizAnalysis } from "../../../api/newQuizAnalysis.js";
4
- import { getItemAnalyses } from "../../../api/newItemAnalyses.js";
5
- export function mapStateToProps(_state) {
6
- return {
7
- getQuizAnalysis: getQuizAnalysis,
8
- getItemAnalyses: getItemAnalyses
9
- };
10
- }
11
- export var NewQuizAndItemAnalysis = connect(mapStateToProps)(NewQuizAndItemAnalysisPresenter);
1
+ import { NewQuizAndItemAnalysisPresenter } from "./presenter.js";
2
+ import withAnalysisState from "./withAnalysisState.js";
3
+ export var NewQuizAndItemAnalysis = withAnalysisState(NewQuizAndItemAnalysisPresenter);
12
4
  export default NewQuizAndItemAnalysis;
@@ -1,105 +1,37 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
5
  import React, { Component } from 'react';
8
- import PropTypes from 'prop-types';
9
6
  import { Heading } from '@instructure/ui-heading';
10
7
  import NewItemAnalysis from "./NewItemAnalysis/index.js";
11
- import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
12
8
  import NewQuizAnalysis from "./NewQuizAnalysis/index.js";
9
+ import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
13
10
  import t from '@instructure/quiz-i18n/es/format-message';
14
11
  import { Flex } from '@instructure/ui-flex';
15
12
  import { AnalysisUpdateDate } from "./AnalysisUpdateDate/index.js";
13
+ import { itemAnalysisPropType, quizAnalysisPropType } from "./propTypes.js";
14
+ import PropTypes from 'prop-types';
16
15
 
17
- var _ref3 = /*#__PURE__*/React.createElement(Spinner, null);
18
-
19
- export var NewQuizAndItemAnalysis = /*#__PURE__*/function (_Component) {
20
- _inherits(NewQuizAndItemAnalysis, _Component);
21
-
22
- var _super = _createSuper(NewQuizAndItemAnalysis);
23
-
24
- function NewQuizAndItemAnalysis(props) {
25
- var _this;
26
-
27
- _classCallCheck(this, NewQuizAndItemAnalysis);
28
-
29
- _this = _super.call(this, props);
30
- _this.fetchQuizAnalysis = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
- var _this$props, activeQuizId, getQuizAnalysis, response;
32
-
33
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) {
35
- switch (_context.prev = _context.next) {
36
- case 0:
37
- _this$props = _this.props, activeQuizId = _this$props.activeQuizId, getQuizAnalysis = _this$props.getQuizAnalysis;
38
- _context.next = 3;
39
- return getQuizAnalysis(activeQuizId);
40
-
41
- case 3:
42
- response = _context.sent;
43
-
44
- if (response) {
45
- _this.setState({
46
- quizAnalysis: response.last_successful_analysis
47
- });
48
- }
49
-
50
- case 5:
51
- case "end":
52
- return _context.stop();
53
- }
54
- }
55
- }, _callee);
56
- }));
57
- _this.fetchItemAnalyses = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
58
- var _this$props2, activeQuizId, getItemAnalyses, response;
16
+ var _ref = /*#__PURE__*/React.createElement(Spinner, null);
59
17
 
60
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
61
- while (1) {
62
- switch (_context2.prev = _context2.next) {
63
- case 0:
64
- _this$props2 = _this.props, activeQuizId = _this$props2.activeQuizId, getItemAnalyses = _this$props2.getItemAnalyses;
65
- _context2.next = 3;
66
- return getItemAnalyses(activeQuizId);
18
+ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
19
+ _inherits(NewQuizAndItemAnalysisPresenter, _Component);
67
20
 
68
- case 3:
69
- response = _context2.sent;
21
+ var _super = _createSuper(NewQuizAndItemAnalysisPresenter);
70
22
 
71
- if (response) {
72
- _this.setState({
73
- itemAnalyses: response.last_successful_analysis
74
- });
75
- }
23
+ function NewQuizAndItemAnalysisPresenter() {
24
+ _classCallCheck(this, NewQuizAndItemAnalysisPresenter);
76
25
 
77
- case 5:
78
- case "end":
79
- return _context2.stop();
80
- }
81
- }
82
- }, _callee2);
83
- }));
84
- _this.state = {
85
- quizAnalysis: null,
86
- itemAnalyses: null
87
- };
88
- return _this;
26
+ return _super.apply(this, arguments);
89
27
  }
90
28
 
91
- _createClass(NewQuizAndItemAnalysis, [{
92
- key: "componentDidMount",
93
- value: function componentDidMount() {
94
- this.fetchQuizAnalysis();
95
- this.fetchItemAnalyses();
96
- }
97
- }, {
29
+ _createClass(NewQuizAndItemAnalysisPresenter, [{
98
30
  key: "renderContent",
99
31
  value: function renderContent() {
100
- var _this$state = this.state,
101
- quizAnalysis = _this$state.quizAnalysis,
102
- itemAnalyses = _this$state.itemAnalyses;
32
+ var _this$props = this.props,
33
+ quizAnalysis = _this$props.quizAnalysis,
34
+ itemAnalyses = _this$props.itemAnalyses;
103
35
  return /*#__PURE__*/React.createElement("div", {
104
36
  className: "fs-mask"
105
37
  }, /*#__PURE__*/React.createElement(Flex, {
@@ -123,24 +55,27 @@ export var NewQuizAndItemAnalysis = /*#__PURE__*/function (_Component) {
123
55
  }, {
124
56
  key: "render",
125
57
  value: function render() {
126
- var _this$state2 = this.state,
127
- quizAnalysis = _this$state2.quizAnalysis,
128
- itemAnalyses = _this$state2.itemAnalyses;
58
+ var _this$props2 = this.props,
59
+ quizAnalysis = _this$props2.quizAnalysis,
60
+ itemAnalyses = _this$props2.itemAnalyses;
129
61
 
130
62
  if (quizAnalysis && itemAnalyses) {
131
63
  return this.renderContent();
132
64
  } else {
133
- return _ref3;
65
+ return _ref;
134
66
  }
135
67
  }
136
68
  }]);
137
69
 
138
- NewQuizAndItemAnalysis.displayName = "NewQuizAndItemAnalysis";
139
- return NewQuizAndItemAnalysis;
70
+ NewQuizAndItemAnalysisPresenter.displayName = "NewQuizAndItemAnalysisPresenter";
71
+ return NewQuizAndItemAnalysisPresenter;
140
72
  }(Component);
141
- NewQuizAndItemAnalysis.propTypes = {
142
- activeQuizId: PropTypes.string.isRequired,
143
- getQuizAnalysis: PropTypes.func.isRequired,
144
- getItemAnalyses: PropTypes.func.isRequired
73
+ NewQuizAndItemAnalysisPresenter.propTypes = {
74
+ quizAnalysis: quizAnalysisPropType,
75
+ itemAnalyses: PropTypes.arrayOf(itemAnalysisPropType)
76
+ };
77
+ NewQuizAndItemAnalysisPresenter.defaultProps = {
78
+ quizAnalysis: void 0,
79
+ itemAnalyses: void 0
145
80
  };
146
- export default NewQuizAndItemAnalysis;
81
+ export default NewQuizAndItemAnalysisPresenter;
@@ -20,4 +20,25 @@ export var quizAnalysisPropType = PropTypes.shape({
20
20
  students_without_attempt: PropTypes.number,
21
21
  average_attempts: PropTypes.number
22
22
  }).isRequired
23
- }).isRequired;
23
+ });
24
+ export var itemAnalysisPropType = PropTypes.shape({
25
+ attempts: PropTypes.shape({
26
+ students_responded: PropTypes.number,
27
+ students_without_response: PropTypes.number
28
+ }),
29
+ metadata: PropTypes.shape({
30
+ interaction_type: PropTypes.string,
31
+ item_body: PropTypes.string,
32
+ item_id: PropTypes.string,
33
+ item_title: PropTypes.string
34
+ }),
35
+ scores: PropTypes.shape({
36
+ difficulty_index: PropTypes.number,
37
+ discrimination_index: PropTypes.number,
38
+ mean: PropTypes.number,
39
+ median: PropTypes.number,
40
+ pearson_correlation: PropTypes.number,
41
+ points_possible: PropTypes.number,
42
+ quartile_distribution: PropTypes.arrayOf(PropTypes.number)
43
+ })
44
+ });
@@ -0,0 +1,27 @@
1
+ import { withAnalysisStatePresenter } from "./withAnalysisStatePresenter.js";
2
+ import { getQuizAnalysis, getItemAnalyses, getFetchInProgress, getGenerationInProgress, getAnalysisError } from "../../../../common/selectors/analyses.js";
3
+ import { setQuizAnalysis, setItemAnalyses, setFetchInProgress, setGenerationInProgress, setAnalysisError } from "../../../../common/actions/analyses.js";
4
+ import { getQuizAnalysis as fetchQuizAnalysis } from "../../../api/newQuizAnalysis.js";
5
+ import { getItemAnalyses as fetchItemAnalyses } from "../../../api/newItemAnalyses.js";
6
+ import { connect } from "../../../../common/react-redux.js";
7
+ import { compose } from 'redux';
8
+ export function mapStateToProps(state) {
9
+ return {
10
+ quizAnalysis: getQuizAnalysis(state),
11
+ itemAnalyses: getItemAnalyses(state),
12
+ fetchInProgress: getFetchInProgress(state),
13
+ generationInProgress: getGenerationInProgress(state),
14
+ analysisError: getAnalysisError(state),
15
+ fetchQuizAnalysis: fetchQuizAnalysis,
16
+ fetchItemAnalyses: fetchItemAnalyses
17
+ };
18
+ }
19
+ var mapDispatchToProps = {
20
+ setQuizAnalysis: setQuizAnalysis,
21
+ setItemAnalyses: setItemAnalyses,
22
+ setFetchInProgress: setFetchInProgress,
23
+ setGenerationInProgress: setGenerationInProgress,
24
+ setAnalysisError: setAnalysisError
25
+ };
26
+ export var withAnalysisState = compose(connect(mapStateToProps, mapDispatchToProps), withAnalysisStatePresenter);
27
+ export default withAnalysisState;