@instructure/quiz-core 17.63.1-rc.0 → 17.63.1-rc.3
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/actions/analyses.js +7 -1
- package/es/common/reducers/analyses.js +10 -8
- package/es/common/selectors/analyses.js +3 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +13 -17
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/fetchReports.js +15 -12
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/fetchReportsStatus.js +45 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +10 -4
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +53 -13
- package/lib/common/actions/analyses.js +8 -0
- package/lib/common/reducers/analyses.js +13 -8
- package/lib/common/selectors/analyses.js +7 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +13 -17
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/fetchReports.js +15 -12
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/fetchReportsStatus.js +59 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisState.js +10 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js +53 -12
- package/package.json +9 -9
|
@@ -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,
|
|
@@ -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
|
};
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -8,16 +8,16 @@ var _dec, _class, _class2, _temp;
|
|
|
8
8
|
import { Heading } from '@instructure/ui-heading';
|
|
9
9
|
import React, { Component } from 'react';
|
|
10
10
|
var styles = {
|
|
11
|
-
componentId: '
|
|
11
|
+
componentId: 'bnEXV',
|
|
12
12
|
template: function template(theme) {
|
|
13
|
-
return "\n\n.
|
|
13
|
+
return "\n\n.bnEXV_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.bnEXV_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bnEXV_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.bnEXV_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.bnEXV_dPzc,.bnEXV_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}");
|
|
14
14
|
},
|
|
15
|
-
'heading': '
|
|
16
|
-
'cardWrapper': '
|
|
17
|
-
'container': '
|
|
18
|
-
'expandButtonContainer': '
|
|
19
|
-
'metricGroup': '
|
|
20
|
-
'metricsWrapper': '
|
|
15
|
+
'heading': 'bnEXV_eDnN',
|
|
16
|
+
'cardWrapper': 'bnEXV_eKXQ',
|
|
17
|
+
'container': 'bnEXV_crZr',
|
|
18
|
+
'expandButtonContainer': 'bnEXV_bTHH',
|
|
19
|
+
'metricGroup': 'bnEXV_dPzc',
|
|
20
|
+
'metricsWrapper': 'bnEXV_cpZE'
|
|
21
21
|
};
|
|
22
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
23
|
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
@@ -72,12 +72,7 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
72
72
|
className: styles.container
|
|
73
73
|
}, /*#__PURE__*/React.createElement("div", {
|
|
74
74
|
className: styles.metricGroup
|
|
75
|
-
}, /*#__PURE__*/React.createElement(
|
|
76
|
-
metricKey: "median_percentage",
|
|
77
|
-
label: t('Median Score'),
|
|
78
|
-
value: t.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
|
|
79
|
-
suffix: "%"
|
|
80
|
-
}), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
75
|
+
}, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
|
|
81
76
|
metricKey: "stddev",
|
|
82
77
|
value: t.number(scores === null || scores === void 0 ? void 0 : scores.stddev),
|
|
83
78
|
label: t('Standard Deviation'),
|
|
@@ -130,9 +125,10 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
130
125
|
})), /*#__PURE__*/React.createElement("div", {
|
|
131
126
|
className: styles.metricsWrapper
|
|
132
127
|
}, /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
133
|
-
metricKey: "
|
|
134
|
-
label: t('
|
|
135
|
-
value: t.number(
|
|
128
|
+
metricKey: "median_percentage",
|
|
129
|
+
label: t('Median Score'),
|
|
130
|
+
value: t.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
|
|
131
|
+
suffix: "%"
|
|
136
132
|
}), /*#__PURE__*/React.createElement(AnalysisMetric, {
|
|
137
133
|
metricKey: "mean_elapsed_sec",
|
|
138
134
|
label: t('mean elapsed time'),
|
|
@@ -4,13 +4,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
4
4
|
import { getFailedToFetchReports, getLastReportGenerationFailed } from "./errorMessages.js";
|
|
5
5
|
export var fetchReports = /*#__PURE__*/function () {
|
|
6
6
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
7
|
-
var activeQuizId, setFetchInProgress, setQuizAnalysis, setItemAnalyses, setAnalysisError, setGenerationInProgress, addError, fetchQuizAnalysis, fetchItemAnalyses, _yield$Promise$all, _yield$Promise$all2, quizAnalysis, itemAnalyses;
|
|
7
|
+
var activeQuizId, setFetchInProgress, setQuizAnalysis, setItemAnalyses, setStatusPollingInProgress, setAnalysisError, setGenerationInProgress, addError, fetchQuizAnalysis, fetchItemAnalyses, _yield$Promise$all, _yield$Promise$all2, quizAnalysis, itemAnalyses, areAnalysesInProgress, areAnalysesFailed;
|
|
8
8
|
|
|
9
9
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
10
10
|
while (1) {
|
|
11
11
|
switch (_context.prev = _context.next) {
|
|
12
12
|
case 0:
|
|
13
|
-
activeQuizId = _ref.activeQuizId, setFetchInProgress = _ref.setFetchInProgress, setQuizAnalysis = _ref.setQuizAnalysis, setItemAnalyses = _ref.setItemAnalyses, setAnalysisError = _ref.setAnalysisError, setGenerationInProgress = _ref.setGenerationInProgress, addError = _ref.addError, fetchQuizAnalysis = _ref.fetchQuizAnalysis, fetchItemAnalyses = _ref.fetchItemAnalyses;
|
|
13
|
+
activeQuizId = _ref.activeQuizId, setFetchInProgress = _ref.setFetchInProgress, setQuizAnalysis = _ref.setQuizAnalysis, setItemAnalyses = _ref.setItemAnalyses, setStatusPollingInProgress = _ref.setStatusPollingInProgress, setAnalysisError = _ref.setAnalysisError, setGenerationInProgress = _ref.setGenerationInProgress, addError = _ref.addError, fetchQuizAnalysis = _ref.fetchQuizAnalysis, fetchItemAnalyses = _ref.fetchItemAnalyses;
|
|
14
14
|
_context.prev = 1;
|
|
15
15
|
setFetchInProgress(true);
|
|
16
16
|
_context.next = 5;
|
|
@@ -21,33 +21,36 @@ export var fetchReports = /*#__PURE__*/function () {
|
|
|
21
21
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
22
22
|
quizAnalysis = _yield$Promise$all2[0];
|
|
23
23
|
itemAnalyses = _yield$Promise$all2[1];
|
|
24
|
+
areAnalysesInProgress = quizAnalysis.new_analysis_in_progress || itemAnalyses.new_analysis_in_progress;
|
|
25
|
+
areAnalysesFailed = quizAnalysis.last_analysis_failed || itemAnalyses.last_analysis_failed;
|
|
26
|
+
setGenerationInProgress(areAnalysesInProgress);
|
|
27
|
+
setStatusPollingInProgress(areAnalysesInProgress);
|
|
24
28
|
setQuizAnalysis(quizAnalysis.last_successful_analysis);
|
|
25
29
|
setItemAnalyses(itemAnalyses.last_successful_analysis);
|
|
26
|
-
setGenerationInProgress(quizAnalysis.new_analysis_in_progress || itemAnalyses.new_analysis_in_progress);
|
|
27
30
|
|
|
28
|
-
if (
|
|
31
|
+
if (areAnalysesFailed) {
|
|
29
32
|
setAnalysisError(getLastReportGenerationFailed());
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
_context.next =
|
|
35
|
+
_context.next = 21;
|
|
33
36
|
break;
|
|
34
37
|
|
|
35
|
-
case
|
|
36
|
-
_context.prev =
|
|
38
|
+
case 18:
|
|
39
|
+
_context.prev = 18;
|
|
37
40
|
_context.t0 = _context["catch"](1);
|
|
38
41
|
addError(getFailedToFetchReports());
|
|
39
42
|
|
|
40
|
-
case
|
|
41
|
-
_context.prev =
|
|
43
|
+
case 21:
|
|
44
|
+
_context.prev = 21;
|
|
42
45
|
setFetchInProgress(false);
|
|
43
|
-
return _context.finish(
|
|
46
|
+
return _context.finish(21);
|
|
44
47
|
|
|
45
|
-
case
|
|
48
|
+
case 24:
|
|
46
49
|
case "end":
|
|
47
50
|
return _context.stop();
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
}, _callee, null, [[1,
|
|
53
|
+
}, _callee, null, [[1, 18, 21, 24]]);
|
|
51
54
|
}));
|
|
52
55
|
|
|
53
56
|
return function fetchReports(_x) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import { getFailedToFetchReports } from "./errorMessages.js";
|
|
4
|
+
export var fetchReportsStatus = /*#__PURE__*/function () {
|
|
5
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
6
|
+
var activeQuizId, addError, fetchAnalysesStatus, instrumentedFetchReports, setStatusPollingInProgress, setGenerationInProgress, status, isReportGenerationReady;
|
|
7
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8
|
+
while (1) {
|
|
9
|
+
switch (_context.prev = _context.next) {
|
|
10
|
+
case 0:
|
|
11
|
+
activeQuizId = _ref.activeQuizId, addError = _ref.addError, fetchAnalysesStatus = _ref.fetchAnalysesStatus, instrumentedFetchReports = _ref.instrumentedFetchReports, setStatusPollingInProgress = _ref.setStatusPollingInProgress, setGenerationInProgress = _ref.setGenerationInProgress;
|
|
12
|
+
_context.prev = 1;
|
|
13
|
+
_context.next = 4;
|
|
14
|
+
return fetchAnalysesStatus(activeQuizId);
|
|
15
|
+
|
|
16
|
+
case 4:
|
|
17
|
+
status = _context.sent;
|
|
18
|
+
isReportGenerationReady = !status.quiz_analysis_in_progress && !status.item_analyses_in_progress;
|
|
19
|
+
|
|
20
|
+
if (isReportGenerationReady) {
|
|
21
|
+
instrumentedFetchReports();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_context.next = 14;
|
|
25
|
+
break;
|
|
26
|
+
|
|
27
|
+
case 9:
|
|
28
|
+
_context.prev = 9;
|
|
29
|
+
_context.t0 = _context["catch"](1);
|
|
30
|
+
addError(getFailedToFetchReports());
|
|
31
|
+
setStatusPollingInProgress(false);
|
|
32
|
+
setGenerationInProgress(false);
|
|
33
|
+
|
|
34
|
+
case 14:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, _callee, null, [[1, 9]]);
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
return function fetchReportsStatus(_x) {
|
|
43
|
+
return _ref2.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}();
|
|
@@ -1,22 +1,27 @@
|
|
|
1
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";
|
|
2
|
+
import { getQuizAnalysis, getItemAnalyses, getFetchInProgress, getGenerationInProgress, getAnalysisError, getStatusPollingInProgress } from "../../../../common/selectors/analyses.js";
|
|
3
|
+
import { setQuizAnalysis, setItemAnalyses, setFetchInProgress, setGenerationInProgress, setAnalysisError, setStatusPollingInProgress } from "../../../../common/actions/analyses.js";
|
|
4
4
|
import { getQuizAnalysis as fetchQuizAnalysis } from "../../../api/getQuizAnalysis.js";
|
|
5
5
|
import { getItemAnalyses as fetchItemAnalyses } from "../../../api/getItemAnalyses.js";
|
|
6
|
+
import { getAnalysesStatus as fetchAnalysesStatus } from "../../../api/getAnalysesStatus.js";
|
|
6
7
|
import { connect } from "../../../../common/react-redux.js";
|
|
7
8
|
import { compose } from 'redux';
|
|
8
9
|
import { getActiveQuizId } from "../../../../common/selectors/quizzes.js";
|
|
9
10
|
import { addError } from "../../../../common/actions/alerts.js";
|
|
11
|
+
var DEFAULT_POLLING_INTERVAL = 3000;
|
|
10
12
|
export function mapStateToProps(state, ownProps) {
|
|
11
13
|
return {
|
|
12
14
|
quizAnalysis: getQuizAnalysis(state),
|
|
13
15
|
itemAnalyses: getItemAnalyses(state),
|
|
14
16
|
fetchInProgress: getFetchInProgress(state),
|
|
15
17
|
generationInProgress: getGenerationInProgress(state),
|
|
18
|
+
statusPollingInProgress: getStatusPollingInProgress(state),
|
|
16
19
|
analysisError: getAnalysisError(state),
|
|
17
20
|
activeQuizId: ownProps.activeQuizId || getActiveQuizId(state),
|
|
18
21
|
fetchQuizAnalysis: fetchQuizAnalysis,
|
|
19
|
-
fetchItemAnalyses: fetchItemAnalyses
|
|
22
|
+
fetchItemAnalyses: fetchItemAnalyses,
|
|
23
|
+
fetchAnalysesStatus: fetchAnalysesStatus,
|
|
24
|
+
pollingInterval: ownProps.pollingInterval || DEFAULT_POLLING_INTERVAL
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
27
|
var mapDispatchToProps = {
|
|
@@ -25,7 +30,8 @@ var mapDispatchToProps = {
|
|
|
25
30
|
setFetchInProgress: setFetchInProgress,
|
|
26
31
|
setGenerationInProgress: setGenerationInProgress,
|
|
27
32
|
setAnalysisError: setAnalysisError,
|
|
28
|
-
addError: addError
|
|
33
|
+
addError: addError,
|
|
34
|
+
setStatusPollingInProgress: setStatusPollingInProgress
|
|
29
35
|
};
|
|
30
36
|
export var withAnalysisState = compose(connect(mapStateToProps, mapDispatchToProps), withAnalysisStatePresenter);
|
|
31
37
|
export default withAnalysisState;
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
import React, { useEffect } from 'react';
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { itemAnalysisPropType, quizAnalysisPropType } from "./propTypes.js";
|
|
7
7
|
import { fetchReports } from "./fetchReports.js";
|
|
8
|
+
import { fetchReportsStatus } from "./fetchReportsStatus.js";
|
|
8
9
|
export var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalComponent) {
|
|
9
10
|
var WithAnalysisStatePresenter = function WithAnalysisStatePresenter(_ref) {
|
|
10
11
|
var quizAnalysis = _ref.quizAnalysis,
|
|
@@ -22,19 +23,39 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
|
|
|
22
23
|
generateReport = _ref.generateReport,
|
|
23
24
|
fetchQuizAnalysis = _ref.fetchQuizAnalysis,
|
|
24
25
|
fetchItemAnalyses = _ref.fetchItemAnalyses,
|
|
25
|
-
|
|
26
|
+
fetchAnalysesStatus = _ref.fetchAnalysesStatus,
|
|
27
|
+
statusPollingInProgress = _ref.statusPollingInProgress,
|
|
28
|
+
setStatusPollingInProgress = _ref.setStatusPollingInProgress,
|
|
29
|
+
pollingInterval = _ref.pollingInterval,
|
|
30
|
+
passThroughProps = _objectWithoutProperties(_ref, ["quizAnalysis", "itemAnalyses", "fetchInProgress", "generationInProgress", "analysisError", "setQuizAnalysis", "addError", "setItemAnalyses", "setFetchInProgress", "setGenerationInProgress", "setAnalysisError", "activeQuizId", "generateReport", "fetchQuizAnalysis", "fetchItemAnalyses", "fetchAnalysesStatus", "statusPollingInProgress", "setStatusPollingInProgress", "pollingInterval"]);
|
|
26
31
|
|
|
27
32
|
WithAnalysisStatePresenter.displayName = "WithAnalysisStatePresenter(".concat(OriginalComponent.displayName || OriginalComponent.name, ")");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
var runningInterval = useRef(null);
|
|
34
|
+
|
|
35
|
+
var instrumentedFetchReports = function instrumentedFetchReports() {
|
|
36
|
+
return fetchReports({
|
|
37
|
+
activeQuizId: activeQuizId,
|
|
38
|
+
addError: addError,
|
|
39
|
+
fetchQuizAnalysis: fetchQuizAnalysis,
|
|
40
|
+
fetchItemAnalyses: fetchItemAnalyses,
|
|
41
|
+
setAnalysisError: setAnalysisError,
|
|
42
|
+
setStatusPollingInProgress: setStatusPollingInProgress,
|
|
43
|
+
setItemAnalyses: setItemAnalyses,
|
|
44
|
+
setGenerationInProgress: setGenerationInProgress,
|
|
45
|
+
setFetchInProgress: setFetchInProgress,
|
|
46
|
+
setQuizAnalysis: setQuizAnalysis
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var instrumentedStatusFetching = function instrumentedStatusFetching() {
|
|
51
|
+
return fetchReportsStatus({
|
|
52
|
+
activeQuizId: activeQuizId,
|
|
53
|
+
addError: addError,
|
|
54
|
+
setGenerationInProgress: setGenerationInProgress,
|
|
55
|
+
setStatusPollingInProgress: setStatusPollingInProgress,
|
|
56
|
+
fetchAnalysesStatus: fetchAnalysesStatus,
|
|
57
|
+
instrumentedFetchReports: instrumentedFetchReports
|
|
58
|
+
});
|
|
38
59
|
};
|
|
39
60
|
|
|
40
61
|
function generateReports() {
|
|
@@ -72,7 +93,7 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
|
|
|
72
93
|
}
|
|
73
94
|
|
|
74
95
|
_context.next = 4;
|
|
75
|
-
return
|
|
96
|
+
return instrumentedFetchReports();
|
|
76
97
|
|
|
77
98
|
case 4:
|
|
78
99
|
case "end":
|
|
@@ -89,6 +110,21 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
|
|
|
89
110
|
|
|
90
111
|
fetchIfNeeded();
|
|
91
112
|
}, []);
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
if (statusPollingInProgress && !runningInterval.current) {
|
|
115
|
+
runningInterval.current = setInterval(instrumentedStatusFetching, pollingInterval);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!statusPollingInProgress && runningInterval.current) {
|
|
119
|
+
clearInterval(runningInterval.current);
|
|
120
|
+
runningInterval.current = null;
|
|
121
|
+
} // unmount cleanup
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
return function () {
|
|
125
|
+
return clearInterval(runningInterval.current);
|
|
126
|
+
};
|
|
127
|
+
}, [statusPollingInProgress]);
|
|
92
128
|
return /*#__PURE__*/React.createElement(OriginalComponent, Object.assign({
|
|
93
129
|
quizAnalysis: quizAnalysis,
|
|
94
130
|
itemAnalyses: itemAnalyses,
|
|
@@ -104,16 +140,20 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
|
|
|
104
140
|
itemAnalyses: PropTypes.arrayOf(itemAnalysisPropType),
|
|
105
141
|
fetchInProgress: PropTypes.bool.isRequired,
|
|
106
142
|
generationInProgress: PropTypes.bool.isRequired,
|
|
143
|
+
statusPollingInProgress: PropTypes.bool.isRequired,
|
|
107
144
|
analysisError: PropTypes.string,
|
|
108
145
|
setQuizAnalysis: PropTypes.func.isRequired,
|
|
109
146
|
setItemAnalyses: PropTypes.func.isRequired,
|
|
110
147
|
setFetchInProgress: PropTypes.func.isRequired,
|
|
111
148
|
setGenerationInProgress: PropTypes.func.isRequired,
|
|
112
149
|
setAnalysisError: PropTypes.func.isRequired,
|
|
150
|
+
setStatusPollingInProgress: PropTypes.func.isRequired,
|
|
113
151
|
activeQuizId: PropTypes.string.isRequired,
|
|
114
152
|
fetchQuizAnalysis: PropTypes.func.isRequired,
|
|
115
153
|
fetchItemAnalyses: PropTypes.func.isRequired,
|
|
154
|
+
fetchAnalysesStatus: PropTypes.func.isRequired,
|
|
116
155
|
addError: PropTypes.func.isRequired,
|
|
156
|
+
pollingInterval: PropTypes.number.isRequired,
|
|
117
157
|
// can be required after passed from LTI
|
|
118
158
|
generateReport: PropTypes.func
|
|
119
159
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.setQuizAnalysis = setQuizAnalysis;
|
|
7
7
|
exports.setItemAnalyses = setItemAnalyses;
|
|
8
8
|
exports.setFetchInProgress = setFetchInProgress;
|
|
9
|
+
exports.setStatusPollingInProgress = setStatusPollingInProgress;
|
|
9
10
|
exports.setGenerationInProgress = setGenerationInProgress;
|
|
10
11
|
exports.setAnalysisError = setAnalysisError;
|
|
11
12
|
|
|
@@ -32,6 +33,13 @@ function setFetchInProgress(inProgress) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
function setStatusPollingInProgress(inProgress) {
|
|
37
|
+
return {
|
|
38
|
+
type: _quizCommon.SET_STATUS_POLLING_IN_PROGRESS,
|
|
39
|
+
payload: inProgress
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
function setGenerationInProgress(inProgress) {
|
|
36
44
|
return {
|
|
37
45
|
type: _quizCommon.SET_ANALYSIS_GENERATION_IN_PROGRESS,
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.default = exports.defaultState = exports.errorKey = exports.generationInProgressKey = exports.fetchInProgressKey = exports.itemAnalysesKey = exports.quizAnalysisKey = void 0;
|
|
8
|
+
exports.default = exports.defaultState = exports.errorKey = exports.statusPollingInProgressKey = exports.generationInProgressKey = exports.fetchInProgressKey = exports.itemAnalysesKey = exports.quizAnalysisKey = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
11
|
|
|
8
12
|
var _immutable = require("immutable");
|
|
9
13
|
|
|
10
14
|
var _quizCommon = require("@instructure/quiz-common");
|
|
11
15
|
|
|
16
|
+
var _fromJS;
|
|
17
|
+
|
|
12
18
|
var quizAnalysisKey = 'quizAnalysis';
|
|
13
19
|
exports.quizAnalysisKey = quizAnalysisKey;
|
|
14
20
|
var itemAnalysesKey = 'itemAnalyses';
|
|
@@ -17,15 +23,11 @@ var fetchInProgressKey = 'fetchInProgress';
|
|
|
17
23
|
exports.fetchInProgressKey = fetchInProgressKey;
|
|
18
24
|
var generationInProgressKey = 'generationInProgress';
|
|
19
25
|
exports.generationInProgressKey = generationInProgressKey;
|
|
26
|
+
var statusPollingInProgressKey = 'statusPollingInProgress';
|
|
27
|
+
exports.statusPollingInProgressKey = statusPollingInProgressKey;
|
|
20
28
|
var errorKey = 'analysisError';
|
|
21
29
|
exports.errorKey = errorKey;
|
|
22
|
-
var defaultState = (0, _immutable.fromJS)({
|
|
23
|
-
quizAnalysisKey: void 0,
|
|
24
|
-
itemAnalysesKey: void 0,
|
|
25
|
-
fetchStateKey: false,
|
|
26
|
-
generationStateKey: false,
|
|
27
|
-
errorKey: void 0
|
|
28
|
-
});
|
|
30
|
+
var defaultState = (0, _immutable.fromJS)((_fromJS = {}, (0, _defineProperty2.default)(_fromJS, quizAnalysisKey, void 0), (0, _defineProperty2.default)(_fromJS, itemAnalysesKey, void 0), (0, _defineProperty2.default)(_fromJS, fetchInProgressKey, false), (0, _defineProperty2.default)(_fromJS, generationInProgressKey, false), (0, _defineProperty2.default)(_fromJS, statusPollingInProgressKey, false), (0, _defineProperty2.default)(_fromJS, errorKey, void 0), _fromJS));
|
|
29
31
|
exports.defaultState = defaultState;
|
|
30
32
|
|
|
31
33
|
var _default = function _default() {
|
|
@@ -45,6 +47,9 @@ var _default = function _default() {
|
|
|
45
47
|
case _quizCommon.SET_ANALYSIS_GENERATION_IN_PROGRESS:
|
|
46
48
|
return state.set(generationInProgressKey, action.payload);
|
|
47
49
|
|
|
50
|
+
case _quizCommon.SET_STATUS_POLLING_IN_PROGRESS:
|
|
51
|
+
return state.set(statusPollingInProgressKey, action.payload);
|
|
52
|
+
|
|
48
53
|
case _quizCommon.SET_ANALYSIS_ERROR:
|
|
49
54
|
return state.set(errorKey, action.payload);
|
|
50
55
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getAnalysisError = exports.getGenerationInProgress = exports.getFetchInProgress = exports.getItemAnalyses = exports.getQuizAnalysis = void 0;
|
|
6
|
+
exports.getAnalysisError = exports.getGenerationInProgress = exports.getStatusPollingInProgress = exports.getFetchInProgress = exports.getItemAnalyses = exports.getQuizAnalysis = void 0;
|
|
7
7
|
var path = 'analyses';
|
|
8
8
|
|
|
9
9
|
var getQuizAnalysis = function getQuizAnalysis(state) {
|
|
@@ -28,6 +28,12 @@ var getFetchInProgress = function getFetchInProgress(state) {
|
|
|
28
28
|
|
|
29
29
|
exports.getFetchInProgress = getFetchInProgress;
|
|
30
30
|
|
|
31
|
+
var getStatusPollingInProgress = function getStatusPollingInProgress(state) {
|
|
32
|
+
return state.getIn([path, 'statusPollingInProgress'], false);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.getStatusPollingInProgress = getStatusPollingInProgress;
|
|
36
|
+
|
|
31
37
|
var getGenerationInProgress = function getGenerationInProgress(state) {
|
|
32
38
|
return state.getIn([path, 'generationInProgress'], false);
|
|
33
39
|
};
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -44,16 +44,16 @@ var _propTypes = require("../propTypes.js");
|
|
|
44
44
|
var _dec, _class, _class2, _temp;
|
|
45
45
|
|
|
46
46
|
var styles = {
|
|
47
|
-
componentId: '
|
|
47
|
+
componentId: 'bnEXV',
|
|
48
48
|
template: function template(theme) {
|
|
49
|
-
return "\n\n.
|
|
49
|
+
return "\n\n.bnEXV_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.bnEXV_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bnEXV_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.bnEXV_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.bnEXV_dPzc,.bnEXV_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}");
|
|
50
50
|
},
|
|
51
|
-
'heading': '
|
|
52
|
-
'cardWrapper': '
|
|
53
|
-
'container': '
|
|
54
|
-
'expandButtonContainer': '
|
|
55
|
-
'metricGroup': '
|
|
56
|
-
'metricsWrapper': '
|
|
51
|
+
'heading': 'bnEXV_eDnN',
|
|
52
|
+
'cardWrapper': 'bnEXV_eKXQ',
|
|
53
|
+
'container': 'bnEXV_crZr',
|
|
54
|
+
'expandButtonContainer': 'bnEXV_bTHH',
|
|
55
|
+
'metricGroup': 'bnEXV_dPzc',
|
|
56
|
+
'metricsWrapper': 'bnEXV_cpZE'
|
|
57
57
|
};
|
|
58
58
|
var stdDevPopoverTexts = {
|
|
59
59
|
title: 'Lorem ipsum ',
|
|
@@ -98,12 +98,7 @@ var NewQuizAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
98
98
|
className: styles.container
|
|
99
99
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
100
|
className: styles.metricGroup
|
|
101
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
102
|
-
metricKey: "median_percentage",
|
|
103
|
-
label: (0, _formatMessage.default)('Median Score'),
|
|
104
|
-
value: _formatMessage.default.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
|
|
105
|
-
suffix: "%"
|
|
106
|
-
}), /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
107
102
|
metricKey: "stddev",
|
|
108
103
|
value: _formatMessage.default.number(scores === null || scores === void 0 ? void 0 : scores.stddev),
|
|
109
104
|
label: (0, _formatMessage.default)('Standard Deviation'),
|
|
@@ -156,9 +151,10 @@ var NewQuizAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
156
151
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
157
152
|
className: styles.metricsWrapper
|
|
158
153
|
}, /*#__PURE__*/_react.default.createElement(_index4.default, {
|
|
159
|
-
metricKey: "
|
|
160
|
-
label: (0, _formatMessage.default)('
|
|
161
|
-
value: _formatMessage.default.number(
|
|
154
|
+
metricKey: "median_percentage",
|
|
155
|
+
label: (0, _formatMessage.default)('Median Score'),
|
|
156
|
+
value: _formatMessage.default.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
|
|
157
|
+
suffix: "%"
|
|
162
158
|
}), /*#__PURE__*/_react.default.createElement(_index4.default, {
|
|
163
159
|
metricKey: "mean_elapsed_sec",
|
|
164
160
|
label: (0, _formatMessage.default)('mean elapsed time'),
|
|
@@ -17,13 +17,13 @@ var _errorMessages = require("./errorMessages.js");
|
|
|
17
17
|
|
|
18
18
|
var fetchReports = /*#__PURE__*/function () {
|
|
19
19
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
20
|
-
var activeQuizId, setFetchInProgress, setQuizAnalysis, setItemAnalyses, setAnalysisError, setGenerationInProgress, addError, fetchQuizAnalysis, fetchItemAnalyses, _yield$Promise$all, _yield$Promise$all2, quizAnalysis, itemAnalyses;
|
|
20
|
+
var activeQuizId, setFetchInProgress, setQuizAnalysis, setItemAnalyses, setStatusPollingInProgress, setAnalysisError, setGenerationInProgress, addError, fetchQuizAnalysis, fetchItemAnalyses, _yield$Promise$all, _yield$Promise$all2, quizAnalysis, itemAnalyses, areAnalysesInProgress, areAnalysesFailed;
|
|
21
21
|
|
|
22
22
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
23
23
|
while (1) {
|
|
24
24
|
switch (_context.prev = _context.next) {
|
|
25
25
|
case 0:
|
|
26
|
-
activeQuizId = _ref.activeQuizId, setFetchInProgress = _ref.setFetchInProgress, setQuizAnalysis = _ref.setQuizAnalysis, setItemAnalyses = _ref.setItemAnalyses, setAnalysisError = _ref.setAnalysisError, setGenerationInProgress = _ref.setGenerationInProgress, addError = _ref.addError, fetchQuizAnalysis = _ref.fetchQuizAnalysis, fetchItemAnalyses = _ref.fetchItemAnalyses;
|
|
26
|
+
activeQuizId = _ref.activeQuizId, setFetchInProgress = _ref.setFetchInProgress, setQuizAnalysis = _ref.setQuizAnalysis, setItemAnalyses = _ref.setItemAnalyses, setStatusPollingInProgress = _ref.setStatusPollingInProgress, setAnalysisError = _ref.setAnalysisError, setGenerationInProgress = _ref.setGenerationInProgress, addError = _ref.addError, fetchQuizAnalysis = _ref.fetchQuizAnalysis, fetchItemAnalyses = _ref.fetchItemAnalyses;
|
|
27
27
|
_context.prev = 1;
|
|
28
28
|
setFetchInProgress(true);
|
|
29
29
|
_context.next = 5;
|
|
@@ -34,33 +34,36 @@ var fetchReports = /*#__PURE__*/function () {
|
|
|
34
34
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
|
|
35
35
|
quizAnalysis = _yield$Promise$all2[0];
|
|
36
36
|
itemAnalyses = _yield$Promise$all2[1];
|
|
37
|
+
areAnalysesInProgress = quizAnalysis.new_analysis_in_progress || itemAnalyses.new_analysis_in_progress;
|
|
38
|
+
areAnalysesFailed = quizAnalysis.last_analysis_failed || itemAnalyses.last_analysis_failed;
|
|
39
|
+
setGenerationInProgress(areAnalysesInProgress);
|
|
40
|
+
setStatusPollingInProgress(areAnalysesInProgress);
|
|
37
41
|
setQuizAnalysis(quizAnalysis.last_successful_analysis);
|
|
38
42
|
setItemAnalyses(itemAnalyses.last_successful_analysis);
|
|
39
|
-
setGenerationInProgress(quizAnalysis.new_analysis_in_progress || itemAnalyses.new_analysis_in_progress);
|
|
40
43
|
|
|
41
|
-
if (
|
|
44
|
+
if (areAnalysesFailed) {
|
|
42
45
|
setAnalysisError((0, _errorMessages.getLastReportGenerationFailed)());
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
_context.next =
|
|
48
|
+
_context.next = 21;
|
|
46
49
|
break;
|
|
47
50
|
|
|
48
|
-
case
|
|
49
|
-
_context.prev =
|
|
51
|
+
case 18:
|
|
52
|
+
_context.prev = 18;
|
|
50
53
|
_context.t0 = _context["catch"](1);
|
|
51
54
|
addError((0, _errorMessages.getFailedToFetchReports)());
|
|
52
55
|
|
|
53
|
-
case
|
|
54
|
-
_context.prev =
|
|
56
|
+
case 21:
|
|
57
|
+
_context.prev = 21;
|
|
55
58
|
setFetchInProgress(false);
|
|
56
|
-
return _context.finish(
|
|
59
|
+
return _context.finish(21);
|
|
57
60
|
|
|
58
|
-
case
|
|
61
|
+
case 24:
|
|
59
62
|
case "end":
|
|
60
63
|
return _context.stop();
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
}, _callee, null, [[1,
|
|
66
|
+
}, _callee, null, [[1, 18, 21, 24]]);
|
|
64
67
|
}));
|
|
65
68
|
|
|
66
69
|
return function fetchReports(_x) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.fetchReportsStatus = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _errorMessages = require("./errorMessages.js");
|
|
15
|
+
|
|
16
|
+
var fetchReportsStatus = /*#__PURE__*/function () {
|
|
17
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
18
|
+
var activeQuizId, addError, fetchAnalysesStatus, instrumentedFetchReports, setStatusPollingInProgress, setGenerationInProgress, status, isReportGenerationReady;
|
|
19
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
20
|
+
while (1) {
|
|
21
|
+
switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
activeQuizId = _ref.activeQuizId, addError = _ref.addError, fetchAnalysesStatus = _ref.fetchAnalysesStatus, instrumentedFetchReports = _ref.instrumentedFetchReports, setStatusPollingInProgress = _ref.setStatusPollingInProgress, setGenerationInProgress = _ref.setGenerationInProgress;
|
|
24
|
+
_context.prev = 1;
|
|
25
|
+
_context.next = 4;
|
|
26
|
+
return fetchAnalysesStatus(activeQuizId);
|
|
27
|
+
|
|
28
|
+
case 4:
|
|
29
|
+
status = _context.sent;
|
|
30
|
+
isReportGenerationReady = !status.quiz_analysis_in_progress && !status.item_analyses_in_progress;
|
|
31
|
+
|
|
32
|
+
if (isReportGenerationReady) {
|
|
33
|
+
instrumentedFetchReports();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_context.next = 14;
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case 9:
|
|
40
|
+
_context.prev = 9;
|
|
41
|
+
_context.t0 = _context["catch"](1);
|
|
42
|
+
addError((0, _errorMessages.getFailedToFetchReports)());
|
|
43
|
+
setStatusPollingInProgress(false);
|
|
44
|
+
setGenerationInProgress(false);
|
|
45
|
+
|
|
46
|
+
case 14:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, _callee, null, [[1, 9]]);
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
return function fetchReportsStatus(_x) {
|
|
55
|
+
return _ref2.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
}();
|
|
58
|
+
|
|
59
|
+
exports.fetchReportsStatus = fetchReportsStatus;
|
|
@@ -16,6 +16,8 @@ var _getQuizAnalysis = require("../../../api/getQuizAnalysis.js");
|
|
|
16
16
|
|
|
17
17
|
var _getItemAnalyses = require("../../../api/getItemAnalyses.js");
|
|
18
18
|
|
|
19
|
+
var _getAnalysesStatus = require("../../../api/getAnalysesStatus.js");
|
|
20
|
+
|
|
19
21
|
var _reactRedux = require("../../../../common/react-redux.js");
|
|
20
22
|
|
|
21
23
|
var _redux = require("redux");
|
|
@@ -24,16 +26,21 @@ var _quizzes = require("../../../../common/selectors/quizzes.js");
|
|
|
24
26
|
|
|
25
27
|
var _alerts = require("../../../../common/actions/alerts.js");
|
|
26
28
|
|
|
29
|
+
var DEFAULT_POLLING_INTERVAL = 3000;
|
|
30
|
+
|
|
27
31
|
function mapStateToProps(state, ownProps) {
|
|
28
32
|
return {
|
|
29
33
|
quizAnalysis: (0, _analyses.getQuizAnalysis)(state),
|
|
30
34
|
itemAnalyses: (0, _analyses.getItemAnalyses)(state),
|
|
31
35
|
fetchInProgress: (0, _analyses.getFetchInProgress)(state),
|
|
32
36
|
generationInProgress: (0, _analyses.getGenerationInProgress)(state),
|
|
37
|
+
statusPollingInProgress: (0, _analyses.getStatusPollingInProgress)(state),
|
|
33
38
|
analysisError: (0, _analyses.getAnalysisError)(state),
|
|
34
39
|
activeQuizId: ownProps.activeQuizId || (0, _quizzes.getActiveQuizId)(state),
|
|
35
40
|
fetchQuizAnalysis: _getQuizAnalysis.getQuizAnalysis,
|
|
36
|
-
fetchItemAnalyses: _getItemAnalyses.getItemAnalyses
|
|
41
|
+
fetchItemAnalyses: _getItemAnalyses.getItemAnalyses,
|
|
42
|
+
fetchAnalysesStatus: _getAnalysesStatus.getAnalysesStatus,
|
|
43
|
+
pollingInterval: ownProps.pollingInterval || DEFAULT_POLLING_INTERVAL
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
46
|
|
|
@@ -43,7 +50,8 @@ var mapDispatchToProps = {
|
|
|
43
50
|
setFetchInProgress: _analyses2.setFetchInProgress,
|
|
44
51
|
setGenerationInProgress: _analyses2.setGenerationInProgress,
|
|
45
52
|
setAnalysisError: _analyses2.setAnalysisError,
|
|
46
|
-
addError: _alerts.addError
|
|
53
|
+
addError: _alerts.addError,
|
|
54
|
+
setStatusPollingInProgress: _analyses2.setStatusPollingInProgress
|
|
47
55
|
};
|
|
48
56
|
var withAnalysisState = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), _withAnalysisStatePresenter.withAnalysisStatePresenter);
|
|
49
57
|
exports.withAnalysisState = withAnalysisState;
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/withAnalysisStatePresenter.js
CHANGED
|
@@ -23,6 +23,8 @@ var _propTypes2 = require("./propTypes.js");
|
|
|
23
23
|
|
|
24
24
|
var _fetchReports = require("./fetchReports.js");
|
|
25
25
|
|
|
26
|
+
var _fetchReportsStatus = require("./fetchReportsStatus.js");
|
|
27
|
+
|
|
26
28
|
var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalComponent) {
|
|
27
29
|
var WithAnalysisStatePresenter = function WithAnalysisStatePresenter(_ref) {
|
|
28
30
|
var quizAnalysis = _ref.quizAnalysis,
|
|
@@ -40,18 +42,38 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
|
|
|
40
42
|
generateReport = _ref.generateReport,
|
|
41
43
|
fetchQuizAnalysis = _ref.fetchQuizAnalysis,
|
|
42
44
|
fetchItemAnalyses = _ref.fetchItemAnalyses,
|
|
43
|
-
|
|
45
|
+
fetchAnalysesStatus = _ref.fetchAnalysesStatus,
|
|
46
|
+
statusPollingInProgress = _ref.statusPollingInProgress,
|
|
47
|
+
setStatusPollingInProgress = _ref.setStatusPollingInProgress,
|
|
48
|
+
pollingInterval = _ref.pollingInterval,
|
|
49
|
+
passThroughProps = (0, _objectWithoutProperties2.default)(_ref, ["quizAnalysis", "itemAnalyses", "fetchInProgress", "generationInProgress", "analysisError", "setQuizAnalysis", "addError", "setItemAnalyses", "setFetchInProgress", "setGenerationInProgress", "setAnalysisError", "activeQuizId", "generateReport", "fetchQuizAnalysis", "fetchItemAnalyses", "fetchAnalysesStatus", "statusPollingInProgress", "setStatusPollingInProgress", "pollingInterval"]);
|
|
44
50
|
WithAnalysisStatePresenter.displayName = "WithAnalysisStatePresenter(".concat(OriginalComponent.displayName || OriginalComponent.name, ")");
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
var runningInterval = (0, _react.useRef)(null);
|
|
52
|
+
|
|
53
|
+
var instrumentedFetchReports = function instrumentedFetchReports() {
|
|
54
|
+
return (0, _fetchReports.fetchReports)({
|
|
55
|
+
activeQuizId: activeQuizId,
|
|
56
|
+
addError: addError,
|
|
57
|
+
fetchQuizAnalysis: fetchQuizAnalysis,
|
|
58
|
+
fetchItemAnalyses: fetchItemAnalyses,
|
|
59
|
+
setAnalysisError: setAnalysisError,
|
|
60
|
+
setStatusPollingInProgress: setStatusPollingInProgress,
|
|
61
|
+
setItemAnalyses: setItemAnalyses,
|
|
62
|
+
setGenerationInProgress: setGenerationInProgress,
|
|
63
|
+
setFetchInProgress: setFetchInProgress,
|
|
64
|
+
setQuizAnalysis: setQuizAnalysis
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var instrumentedStatusFetching = function instrumentedStatusFetching() {
|
|
69
|
+
return (0, _fetchReportsStatus.fetchReportsStatus)({
|
|
70
|
+
activeQuizId: activeQuizId,
|
|
71
|
+
addError: addError,
|
|
72
|
+
setGenerationInProgress: setGenerationInProgress,
|
|
73
|
+
setStatusPollingInProgress: setStatusPollingInProgress,
|
|
74
|
+
fetchAnalysesStatus: fetchAnalysesStatus,
|
|
75
|
+
instrumentedFetchReports: instrumentedFetchReports
|
|
76
|
+
});
|
|
55
77
|
};
|
|
56
78
|
|
|
57
79
|
function generateReports() {
|
|
@@ -89,7 +111,7 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
|
|
|
89
111
|
}
|
|
90
112
|
|
|
91
113
|
_context.next = 4;
|
|
92
|
-
return (
|
|
114
|
+
return instrumentedFetchReports();
|
|
93
115
|
|
|
94
116
|
case 4:
|
|
95
117
|
case "end":
|
|
@@ -106,6 +128,21 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
|
|
|
106
128
|
|
|
107
129
|
fetchIfNeeded();
|
|
108
130
|
}, []);
|
|
131
|
+
(0, _react.useEffect)(function () {
|
|
132
|
+
if (statusPollingInProgress && !runningInterval.current) {
|
|
133
|
+
runningInterval.current = setInterval(instrumentedStatusFetching, pollingInterval);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!statusPollingInProgress && runningInterval.current) {
|
|
137
|
+
clearInterval(runningInterval.current);
|
|
138
|
+
runningInterval.current = null;
|
|
139
|
+
} // unmount cleanup
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
return function () {
|
|
143
|
+
return clearInterval(runningInterval.current);
|
|
144
|
+
};
|
|
145
|
+
}, [statusPollingInProgress]);
|
|
109
146
|
return /*#__PURE__*/_react.default.createElement(OriginalComponent, Object.assign({
|
|
110
147
|
quizAnalysis: quizAnalysis,
|
|
111
148
|
itemAnalyses: itemAnalyses,
|
|
@@ -121,16 +158,20 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
|
|
|
121
158
|
itemAnalyses: _propTypes.default.arrayOf(_propTypes2.itemAnalysisPropType),
|
|
122
159
|
fetchInProgress: _propTypes.default.bool.isRequired,
|
|
123
160
|
generationInProgress: _propTypes.default.bool.isRequired,
|
|
161
|
+
statusPollingInProgress: _propTypes.default.bool.isRequired,
|
|
124
162
|
analysisError: _propTypes.default.string,
|
|
125
163
|
setQuizAnalysis: _propTypes.default.func.isRequired,
|
|
126
164
|
setItemAnalyses: _propTypes.default.func.isRequired,
|
|
127
165
|
setFetchInProgress: _propTypes.default.func.isRequired,
|
|
128
166
|
setGenerationInProgress: _propTypes.default.func.isRequired,
|
|
129
167
|
setAnalysisError: _propTypes.default.func.isRequired,
|
|
168
|
+
setStatusPollingInProgress: _propTypes.default.func.isRequired,
|
|
130
169
|
activeQuizId: _propTypes.default.string.isRequired,
|
|
131
170
|
fetchQuizAnalysis: _propTypes.default.func.isRequired,
|
|
132
171
|
fetchItemAnalyses: _propTypes.default.func.isRequired,
|
|
172
|
+
fetchAnalysesStatus: _propTypes.default.func.isRequired,
|
|
133
173
|
addError: _propTypes.default.func.isRequired,
|
|
174
|
+
pollingInterval: _propTypes.default.number.isRequired,
|
|
134
175
|
// can be required after passed from LTI
|
|
135
176
|
generateReport: _propTypes.default.func
|
|
136
177
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.63.1-rc.
|
|
3
|
+
"version": "17.63.1-rc.3+bb9038eca",
|
|
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.9",
|
|
44
|
-
"@instructure/quiz-common": "17.63.1-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.63.1-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.63.1-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.63.1-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.63.1-rc.
|
|
44
|
+
"@instructure/quiz-common": "17.63.1-rc.3+bb9038eca",
|
|
45
|
+
"@instructure/quiz-i18n": "17.63.1-rc.3+bb9038eca",
|
|
46
|
+
"@instructure/quiz-interactions": "17.63.1-rc.3+bb9038eca",
|
|
47
|
+
"@instructure/quiz-number-input": "17.63.1-rc.3+bb9038eca",
|
|
48
|
+
"@instructure/quiz-rce": "17.63.1-rc.3+bb9038eca",
|
|
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,7 +106,7 @@
|
|
|
106
106
|
"eventemitter3": "^3.1.0",
|
|
107
107
|
"humps": "^2.0.0",
|
|
108
108
|
"immutable": "^3.8.1",
|
|
109
|
-
"instructure-validations": "17.63.1-rc.
|
|
109
|
+
"instructure-validations": "17.63.1-rc.3+bb9038eca",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"intl": "^1.2.4",
|
|
158
158
|
"jquery": "^2.2.3",
|
|
159
159
|
"most-subject": "^5.3.0",
|
|
160
|
-
"quiz-presets": "17.63.1-rc.
|
|
160
|
+
"quiz-presets": "17.63.1-rc.3+bb9038eca",
|
|
161
161
|
"react": "^16.8.6",
|
|
162
162
|
"react-addons-test-utils": "^15.6.2",
|
|
163
163
|
"react-dom": "^16.8.6",
|
|
@@ -173,5 +173,5 @@
|
|
|
173
173
|
"publishConfig": {
|
|
174
174
|
"access": "public"
|
|
175
175
|
},
|
|
176
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "bb9038eca17319245eda3bfde7b7a77b61c8498a"
|
|
177
177
|
}
|