@instructure/quiz-core 17.63.1-rc.0 → 17.63.1-rc.12

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 (43) hide show
  1. package/es/building/api/qtiImports.js +16 -10
  2. package/es/building/components/QTIImportModal/index.js +1 -1
  3. package/es/common/actions/analyses.js +7 -1
  4. package/es/common/components/shared/spinner/Spinner.js +33 -18
  5. package/es/common/components/shared/spinner/theme.js +2 -5
  6. package/es/common/reducers/analyses.js +10 -8
  7. package/es/common/selectors/analyses.js +3 -0
  8. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerSummaryTable/ChoiceInfo/presenter.js +14 -7
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerSummaryTable/presenter.js +4 -0
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +129 -143
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +2 -1
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +14 -17
  13. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +2 -1
  14. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +85 -30
  15. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +4 -2
  16. package/es/reporting/components/resources/NewQuizAndItemAnalysis/errorMessages.js +3 -0
  17. package/es/reporting/components/resources/NewQuizAndItemAnalysis/fetchReports.js +15 -12
  18. package/es/reporting/components/resources/NewQuizAndItemAnalysis/fetchReportsStatus.js +45 -0
  19. package/es/reporting/components/resources/NewQuizAndItemAnalysis/generateReports.js +52 -0
  20. package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +10 -4
  21. package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +73 -18
  22. package/lib/building/api/qtiImports.js +16 -10
  23. package/lib/building/components/QTIImportModal/index.js +1 -1
  24. package/lib/common/actions/analyses.js +8 -0
  25. package/lib/common/components/shared/spinner/Spinner.js +34 -19
  26. package/lib/common/components/shared/spinner/theme.js +2 -5
  27. package/lib/common/reducers/analyses.js +13 -8
  28. package/lib/common/selectors/analyses.js +7 -1
  29. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerSummaryTable/ChoiceInfo/presenter.js +14 -6
  30. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerSummaryTable/presenter.js +5 -0
  31. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +132 -144
  32. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +2 -1
  33. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +14 -17
  34. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +2 -1
  35. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +84 -29
  36. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +4 -2
  37. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/errorMessages.js +8 -2
  38. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/fetchReports.js +15 -12
  39. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/fetchReportsStatus.js +59 -0
  40. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/generateReports.js +67 -0
  41. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +10 -2
  42. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +74 -17
  43. package/package.json +9 -9
@@ -17,8 +17,8 @@ export var getQTIInfo = function getQTIInfo(quizId) {
17
17
  return fetcher.get(url).then(addImportsToStore);
18
18
  };
19
19
  };
20
- export var pollForQtiInfo = function pollForQtiInfo(parentId, parentType) {
21
- var opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
20
+ export var pollForQtiInfo = function pollForQtiInfo(parentId, parentType, waitForAssignmentSettingsImported) {
21
+ var opts = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
22
22
  getExistingBankAndEntries: getExistingBankAndEntries,
23
23
  getExistingQuizAndItems: getExistingQuizAndItems,
24
24
  pollForQtiInfo: pollForQtiInfo
@@ -47,11 +47,17 @@ export var pollForQtiInfo = function pollForQtiInfo(parentId, parentType) {
47
47
  dispatch(opts.getExistingBankAndEntries(parentId));
48
48
  }
49
49
 
50
- dispatch(setUploadStatus(FILE_UPLOAD_SUCCESS));
50
+ if (waitForAssignmentSettingsImported) {
51
+ waitForAssignmentSettingsImported().then(function () {
52
+ dispatch(setUploadStatus(FILE_UPLOAD_SUCCESS));
53
+ });
54
+ } else {
55
+ dispatch(setUploadStatus(FILE_UPLOAD_SUCCESS));
56
+ }
51
57
  } else if (importsList.find(function (qtiImport) {
52
58
  return qtiImport.status !== 'failed';
53
59
  })) {
54
- dispatch(opts.pollForQtiInfo(parentId, parentType, opts));
60
+ dispatch(opts.pollForQtiInfo(parentId, parentType, waitForAssignmentSettingsImported, opts));
55
61
  } else {
56
62
  dispatch(setUploadStatus(FILE_UPLOAD_FAILURE));
57
63
  }
@@ -68,7 +74,7 @@ export var pollForQtiInfo = function pollForQtiInfo(parentId, parentType) {
68
74
  // the url from the first response, and finally receives the promise.
69
75
  // Exported for testing purposes
70
76
 
71
- export var postQtiCreate = function postQtiCreate(qtiImportUrl, dispatch, onError) {
77
+ export var postQtiCreate = function postQtiCreate(qtiImportUrl, dispatch, onError, waitForAssignmentSettingsImported) {
72
78
  return function (url) {
73
79
  var qtiCreateFetcher = new Fetcher({
74
80
  callType: CREATE_QTI_IMPORT,
@@ -81,7 +87,7 @@ export var postQtiCreate = function postQtiCreate(qtiImportUrl, dispatch, onErro
81
87
  var addImportToStore = function addImportToStore(importData) {
82
88
  dispatch(handleQtiImportsResponse([importData]));
83
89
  var parentType = importData.parent_type === 'Quiz' ? PARENT_TYPE_QUIZ : PARENT_TYPE_BANK;
84
- dispatch(pollForQtiInfo(importData.parent_id, parentType));
90
+ dispatch(pollForQtiInfo(importData.parent_id, parentType, waitForAssignmentSettingsImported));
85
91
  };
86
92
 
87
93
  return qtiCreateFetcher.post(qtiImportUrl, {
@@ -89,9 +95,9 @@ export var postQtiCreate = function postQtiCreate(qtiImportUrl, dispatch, onErro
89
95
  }).then(addImportToStore);
90
96
  };
91
97
  };
92
- export var qtiFileUpload = function qtiFileUpload(file, parentId, parentType, onError) {
93
- var withUrlCallback = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : sendFileToS3;
94
- var qtiCreateFxn = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : postQtiCreate;
98
+ export var qtiFileUpload = function qtiFileUpload(file, parentId, parentType, onError, waitForAssignmentSettingsImported) {
99
+ var withUrlCallback = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : sendFileToS3;
100
+ var qtiCreateFxn = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : postQtiCreate;
95
101
  return function (dispatch, getState) {
96
102
  var qtiImportUrl;
97
103
 
@@ -102,7 +108,7 @@ export var qtiFileUpload = function qtiFileUpload(file, parentId, parentType, on
102
108
  }
103
109
 
104
110
  var pathToGetUrl = "".concat(qtiImportUrl, "/upload_url");
105
- var onSuccess = qtiCreateFxn(qtiImportUrl, dispatch, onError);
111
+ var onSuccess = qtiCreateFxn(qtiImportUrl, dispatch, onError, waitForAssignmentSettingsImported);
106
112
  return getUploadUrl(pathToGetUrl).then(withUrlCallback(file, onSuccess, onError));
107
113
  };
108
114
  };
@@ -23,7 +23,7 @@ export var mapDispatchToProps = function mapDispatchToProps(dispatch, props) {
23
23
  return {
24
24
  onContinue: bindActionCreators(clearQtiImports, dispatch),
25
25
  fileUpload: function fileUpload(file, cancelAction) {
26
- boundQtiFileUpload(file, props.parentId, props.parentType, cancelAction);
26
+ boundQtiFileUpload(file, props.parentId, props.parentType, cancelAction, props.waitForAssignmentSettingsImported);
27
27
  }
28
28
  };
29
29
  };
@@ -1,4 +1,4 @@
1
- import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_ANALYSIS_ERROR } from '@instructure/quiz-common';
1
+ import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_ANALYSIS_ERROR, SET_STATUS_POLLING_IN_PROGRESS } from '@instructure/quiz-common';
2
2
  export function setQuizAnalysis(quizAnalysis) {
3
3
  return {
4
4
  type: SET_QUIZ_ANALYSIS,
@@ -17,6 +17,12 @@ export function setFetchInProgress(inProgress) {
17
17
  payload: inProgress
18
18
  };
19
19
  }
20
+ export function setStatusPollingInProgress(inProgress) {
21
+ return {
22
+ type: SET_STATUS_POLLING_IN_PROGRESS,
23
+ payload: inProgress
24
+ };
25
+ }
20
26
  export function setGenerationInProgress(inProgress) {
21
27
  return {
22
28
  type: SET_ANALYSIS_GENERATION_IN_PROGRESS,
@@ -7,20 +7,19 @@ var _dec, _class, _class2, _temp;
7
7
 
8
8
  import React, { Component } from 'react';
9
9
  import PropTypes from 'prop-types';
10
+ import { Text } from '@instructure/ui-text';
10
11
  import { Spinner } from '@instructure/ui-spinner';
11
- import { Heading } from '@instructure/ui-heading';
12
12
  import { PresentationContent } from '@instructure/ui-a11y-content';
13
13
  import { themeable } from '@instructure/ui-themeable';
14
14
  import t from '@instructure/quiz-i18n/es/format-message';
15
15
  var styles = {
16
- componentId: 'ebGcj',
16
+ componentId: 'cJgyM',
17
17
  template: function template(theme) {
18
- return "\n\n.ebGcj_gasz{align-items:center;display:inline-flex;flex:1 1 auto;height:100%;justify-content:center;min-height:500px;width:100%}\n\n:root .ebGcj_gasz,_:-ms-fullscreen{height:10rem}\n\n.ebGcj_bZBM .ebGcj_qrQc{flex:1 1 auto}\n\n.ebGcj_fBqo{font-size:".concat(theme.mainTextFontSize || 'inherit', "}");
18
+ return "\n\n.cJgyM_gasz{align-items:center;column-gap:10px;display:inline-flex;flex:1 1 auto;height:100%;justify-content:center;width:100%}\n\n:root .cJgyM_gasz,_:-ms-fullscreen{height:10rem}\n\n.cJgyM_bZBM .cJgyM_qrQc{flex:1 1 auto}";
19
19
  },
20
- 'wrapper': 'ebGcj_gasz',
21
- 'left': 'ebGcj_bZBM',
22
- 'right': 'ebGcj_qrQc',
23
- 'mainText': 'ebGcj_fBqo'
20
+ 'wrapper': 'cJgyM_gasz',
21
+ 'left': 'cJgyM_bZBM',
22
+ 'right': 'cJgyM_qrQc'
24
23
  };
25
24
  import theme from "./theme.js";
26
25
  export var QuizzesSpinner = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
@@ -37,34 +36,50 @@ export var QuizzesSpinner = (_dec = themeable(theme, styles), _dec(_class = (_te
37
36
  _createClass(QuizzesSpinner, [{
38
37
  key: "mainText",
39
38
  value: function mainText() {
40
- return this.props.mainText || t('Loading...');
39
+ var _this$props = this.props,
40
+ color = _this$props.color,
41
+ mainText = _this$props.mainText,
42
+ fontSize = _this$props.fontSize;
43
+ return /*#__PURE__*/React.createElement(Text, {
44
+ size: fontSize,
45
+ color: color
46
+ }, mainText || t('Loading...'));
41
47
  }
42
48
  }, {
43
49
  key: "render",
44
50
  value: function render() {
51
+ var _this$props2 = this.props,
52
+ size = _this$props2.size,
53
+ minHeight = _this$props2.minHeight;
45
54
  return /*#__PURE__*/React.createElement("div", {
46
- className: styles.wrapper
55
+ className: styles.wrapper,
56
+ style: {
57
+ minHeight: minHeight
58
+ }
47
59
  }, /*#__PURE__*/React.createElement("div", {
48
60
  className: styles.left
49
61
  }, /*#__PURE__*/React.createElement(Spinner, {
50
62
  renderTitle: this.mainText(),
51
- size: "large"
63
+ size: size
52
64
  })), /*#__PURE__*/React.createElement("div", {
53
65
  className: styles.right
54
- }, /*#__PURE__*/React.createElement(PresentationContent, null, /*#__PURE__*/React.createElement(Heading, {
55
- level: "h2",
56
- as: "h1"
57
- }, /*#__PURE__*/React.createElement("div", {
58
- className: styles.mainText
59
- }, this.mainText())))));
66
+ }, /*#__PURE__*/React.createElement(PresentationContent, null, this.mainText())));
60
67
  }
61
68
  }]);
62
69
 
63
70
  QuizzesSpinner.displayName = "QuizzesSpinner";
64
71
  return QuizzesSpinner;
65
72
  }(Component), _class2.propTypes = {
66
- mainText: PropTypes.string
73
+ mainText: PropTypes.string,
74
+ fontSize: PropTypes.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
75
+ size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
76
+ color: PropTypes.string,
77
+ minHeight: PropTypes.string
67
78
  }, _class2.defaultProps = {
68
- mainText: null
79
+ mainText: null,
80
+ size: 'large',
81
+ fontSize: 'xx-large',
82
+ minHeight: '500px',
83
+ color: 'primary'
69
84
  }, _temp)) || _class);
70
85
  export default QuizzesSpinner;
@@ -1,6 +1,3 @@
1
- export default function generator(_ref) {
2
- var typography = _ref.typography;
3
- return {
4
- mainTextFontSize: typography.fontSizeXXLarge
5
- };
1
+ export default function generator() {
2
+ return {};
6
3
  }
@@ -1,17 +1,16 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var _fromJS;
4
+
1
5
  import { fromJS } from 'immutable';
2
- import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_ANALYSIS_ERROR } from '@instructure/quiz-common';
6
+ import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_STATUS_POLLING_IN_PROGRESS, SET_ANALYSIS_ERROR } from '@instructure/quiz-common';
3
7
  export var quizAnalysisKey = 'quizAnalysis';
4
8
  export var itemAnalysesKey = 'itemAnalyses';
5
9
  export var fetchInProgressKey = 'fetchInProgress';
6
10
  export var generationInProgressKey = 'generationInProgress';
11
+ export var statusPollingInProgressKey = 'statusPollingInProgress';
7
12
  export var errorKey = 'analysisError';
8
- export var defaultState = fromJS({
9
- quizAnalysisKey: void 0,
10
- itemAnalysesKey: void 0,
11
- fetchStateKey: false,
12
- generationStateKey: false,
13
- errorKey: void 0
14
- });
13
+ export var defaultState = fromJS((_fromJS = {}, _defineProperty(_fromJS, quizAnalysisKey, void 0), _defineProperty(_fromJS, itemAnalysesKey, void 0), _defineProperty(_fromJS, fetchInProgressKey, false), _defineProperty(_fromJS, generationInProgressKey, false), _defineProperty(_fromJS, statusPollingInProgressKey, false), _defineProperty(_fromJS, errorKey, void 0), _fromJS));
15
14
  export default (function () {
16
15
  var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultState;
17
16
  var action = arguments.length > 1 ? arguments[1] : void 0;
@@ -29,6 +28,9 @@ export default (function () {
29
28
  case SET_ANALYSIS_GENERATION_IN_PROGRESS:
30
29
  return state.set(generationInProgressKey, action.payload);
31
30
 
31
+ case SET_STATUS_POLLING_IN_PROGRESS:
32
+ return state.set(statusPollingInProgressKey, action.payload);
33
+
32
34
  case SET_ANALYSIS_ERROR:
33
35
  return state.set(errorKey, action.payload);
34
36
 
@@ -12,6 +12,9 @@ export var getItemAnalyses = function getItemAnalyses(state) {
12
12
  export var getFetchInProgress = function getFetchInProgress(state) {
13
13
  return state.getIn([path, 'fetchInProgress'], false);
14
14
  };
15
+ export var getStatusPollingInProgress = function getStatusPollingInProgress(state) {
16
+ return state.getIn([path, 'statusPollingInProgress'], false);
17
+ };
15
18
  export var getGenerationInProgress = function getGenerationInProgress(state) {
16
19
  return state.getIn([path, 'generationInProgress'], false);
17
20
  };
@@ -7,11 +7,6 @@ import t from '@instructure/quiz-i18n/es/format-message';
7
7
  import { Table } from '@instructure/ui-table';
8
8
  import Row from "../Row/index.js";
9
9
  import PropTypes from 'prop-types';
10
-
11
- var _ref = /*#__PURE__*/React.createElement(Table.ColHeader, {
12
- width: "46px"
13
- });
14
-
15
10
  export var ChoiceInfo = /*#__PURE__*/function (_Component) {
16
11
  _inherits(ChoiceInfo, _Component);
17
12
 
@@ -58,15 +53,26 @@ export var ChoiceInfo = /*#__PURE__*/function (_Component) {
58
53
  value: function render() {
59
54
  var _this$props = this.props,
60
55
  choices = _this$props.choices,
61
- noAnswer = _this$props.noAnswer;
56
+ noAnswer = _this$props.noAnswer,
57
+ itemId = _this$props.itemId;
62
58
  var numberOfChoices = choices.length;
59
+ var spacingHeaderId = "answer-frequency-summary-spacing-".concat(itemId);
60
+ var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
61
+ var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
62
+ var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
63
63
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, {
64
64
  caption: t('Answer Frequency Summary')
65
- }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, _ref, /*#__PURE__*/React.createElement(Table.ColHeader, {
65
+ }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.ColHeader, {
66
+ id: spacingHeaderId,
67
+ width: "46px"
68
+ }), /*#__PURE__*/React.createElement(Table.ColHeader, {
69
+ id: answerHeaderId,
66
70
  height: "47px"
67
71
  }, t('Answer')), /*#__PURE__*/React.createElement(Table.ColHeader, {
72
+ id: respondentsHeaderId,
68
73
  height: "47px"
69
74
  }, t('Respondents')), /*#__PURE__*/React.createElement(Table.ColHeader, {
75
+ id: percentageHeaderId,
70
76
  height: "47px",
71
77
  textAlign: "center"
72
78
  }, t('%')))), /*#__PURE__*/React.createElement(Table.Body, null, choices.map(this.renderRow), this.renderNoAnswer(noAnswer, numberOfChoices))));
@@ -77,6 +83,7 @@ export var ChoiceInfo = /*#__PURE__*/function (_Component) {
77
83
  return ChoiceInfo;
78
84
  }(Component);
79
85
  ChoiceInfo.propTypes = {
86
+ itemId: PropTypes.number,
80
87
  choices: PropTypes.arrayOf(PropTypes.shape({
81
88
  body: PropTypes.string,
82
89
  correct: PropTypes.bool,
@@ -22,6 +22,7 @@ var styles = {
22
22
  import { ChoiceInfo } from "./ChoiceInfo/presenter.js";
23
23
  import t from '@instructure/quiz-i18n/es/format-message';
24
24
  import { answerSummaryPropType } from "../propTypes.js";
25
+ import { PropTypes } from '@instructure/quiz-interactions';
25
26
  export var AnswerSummaryTable = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
27
  _inherits(AnswerSummaryTable, _Component);
27
28
 
@@ -42,12 +43,14 @@ export var AnswerSummaryTable = (_dec = themeable(theme, styles), _dec(_class =
42
43
  var _this$props$answerSum = _this.props.answerSummary,
43
44
  choices = _this$props$answerSum.choices,
44
45
  no_answer = _this$props$answerSum.no_answer;
46
+ var itemId = _this.props.itemId;
45
47
  return /*#__PURE__*/React.createElement("div", {
46
48
  className: styles.tableWrapper
47
49
  }, /*#__PURE__*/React.createElement(Heading, {
48
50
  margin: "large 0 small 0",
49
51
  level: "h3"
50
52
  }, t('Answer Frequency Summary')), /*#__PURE__*/React.createElement(ChoiceInfo, {
53
+ itemId: itemId,
51
54
  choices: choices,
52
55
  noAnswer: no_answer
53
56
  }));
@@ -58,5 +61,6 @@ export var AnswerSummaryTable = (_dec = themeable(theme, styles), _dec(_class =
58
61
 
59
62
  return AnswerSummaryTable;
60
63
  }(Component), _class2.propTypes = {
64
+ itemId: PropTypes.number,
61
65
  answerSummary: answerSummaryPropType
62
66
  }.isRequired, _temp)) || _class);