@instructure/quiz-core 17.50.2-rc.3 → 17.50.2-rc.5
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/reporting/api/newItemAnalyses.js +38 -0
- package/es/reporting/api/newQuizAnalysis.js +38 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/index.js +6 -8
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +135 -64
- package/lib/reporting/api/newItemAnalyses.js +51 -0
- package/lib/reporting/api/newQuizAnalysis.js +51 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/index.js +6 -8
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +139 -69
- package/package.json +10 -10
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
export var getItemAnalyses = /*#__PURE__*/function () {
|
|
4
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
|
|
5
|
+
var response;
|
|
6
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
7
|
+
while (1) {
|
|
8
|
+
switch (_context.prev = _context.next) {
|
|
9
|
+
case 0:
|
|
10
|
+
_context.prev = 0;
|
|
11
|
+
_context.next = 3;
|
|
12
|
+
return fetch("http://".concat(window.ENV.API_HOST, "/api/quizzes/").concat(quizId, "/stats/new_item_analyses"));
|
|
13
|
+
|
|
14
|
+
case 3:
|
|
15
|
+
response = _context.sent;
|
|
16
|
+
_context.next = 6;
|
|
17
|
+
return response.json();
|
|
18
|
+
|
|
19
|
+
case 6:
|
|
20
|
+
return _context.abrupt("return", _context.sent);
|
|
21
|
+
|
|
22
|
+
case 9:
|
|
23
|
+
_context.prev = 9;
|
|
24
|
+
_context.t0 = _context["catch"](0);
|
|
25
|
+
console.error(_context.t0);
|
|
26
|
+
|
|
27
|
+
case 12:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, _callee, null, [[0, 9]]);
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
return function getItemAnalyses(_x) {
|
|
36
|
+
return _ref.apply(this, arguments);
|
|
37
|
+
};
|
|
38
|
+
}();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
export var getQuizAnalysis = /*#__PURE__*/function () {
|
|
4
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
|
|
5
|
+
var response;
|
|
6
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
7
|
+
while (1) {
|
|
8
|
+
switch (_context.prev = _context.next) {
|
|
9
|
+
case 0:
|
|
10
|
+
_context.prev = 0;
|
|
11
|
+
_context.next = 3;
|
|
12
|
+
return fetch("http://".concat(window.ENV.API_HOST, "/api/quizzes/").concat(quizId, "/stats/new_quiz_analysis"));
|
|
13
|
+
|
|
14
|
+
case 3:
|
|
15
|
+
response = _context.sent;
|
|
16
|
+
_context.next = 6;
|
|
17
|
+
return response.json();
|
|
18
|
+
|
|
19
|
+
case 6:
|
|
20
|
+
return _context.abrupt("return", _context.sent);
|
|
21
|
+
|
|
22
|
+
case 9:
|
|
23
|
+
_context.prev = 9;
|
|
24
|
+
_context.t0 = _context["catch"](0);
|
|
25
|
+
console.error(_context.t0);
|
|
26
|
+
|
|
27
|
+
case 12:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, _callee, null, [[0, 9]]);
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
return function getQuizAnalysis(_x) {
|
|
36
|
+
return _ref.apply(this, arguments);
|
|
37
|
+
};
|
|
38
|
+
}();
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { NewQuizAndItemAnalysis as NewQuizAndItemAnalysisPresenter } from "./presenter.js";
|
|
2
2
|
import { connect } from "../../../../common/react-redux.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export function mapStateToProps(
|
|
6
|
-
var activeQuiz = getActiveQuiz(state);
|
|
3
|
+
import { getQuizAnalysis } from "../../../api/newQuizAnalysis.js";
|
|
4
|
+
import { getItemAnalyses } from "../../../api/newItemAnalyses.js";
|
|
5
|
+
export function mapStateToProps(_state) {
|
|
7
6
|
return {
|
|
8
|
-
|
|
7
|
+
getQuizAnalysis: getQuizAnalysis,
|
|
8
|
+
getItemAnalyses: getItemAnalyses
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export var NewQuizAndItemAnalysis = connect(mapStateToProps
|
|
12
|
-
getExistingQuiz: getExistingQuiz
|
|
13
|
-
})(NewQuizAndItemAnalysisPresenter);
|
|
11
|
+
export var NewQuizAndItemAnalysis = connect(mapStateToProps)(NewQuizAndItemAnalysisPresenter);
|
|
14
12
|
export default NewQuizAndItemAnalysis;
|
|
@@ -1,79 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import React, { Component } from 'react';
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import React, { useEffect, useState } from 'react';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
|
-
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
8
6
|
import { Heading } from '@instructure/ui-heading';
|
|
9
7
|
import { Metric, MetricGroup } from '@instructure/ui-metric';
|
|
10
8
|
import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
|
|
11
|
-
import { withI18nSupport } from '@instructure/quiz-common';
|
|
12
9
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
renderLabel: "Example 2",
|
|
18
|
-
renderValue: "5"
|
|
19
|
-
}), /*#__PURE__*/React.createElement(Metric, {
|
|
20
|
-
renderLabel: "Example 3",
|
|
21
|
-
renderValue: "Good"
|
|
22
|
-
}));
|
|
10
|
+
var _ref4 = /*#__PURE__*/React.createElement(Heading, {
|
|
11
|
+
level: "h3",
|
|
12
|
+
color: "primary"
|
|
13
|
+
}, "Quiz analysis");
|
|
23
14
|
|
|
24
|
-
var
|
|
15
|
+
var _ref5 = /*#__PURE__*/React.createElement(Heading, {
|
|
16
|
+
level: "h3",
|
|
17
|
+
color: "primary"
|
|
18
|
+
}, "Item analysis");
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
_inherits(NewQuizAndItemAnalysis, _withI18nSupport);
|
|
20
|
+
var _ref6 = /*#__PURE__*/React.createElement(Spinner, null);
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
export var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
|
|
23
|
+
var activeQuizId = _ref.activeQuizId,
|
|
24
|
+
getQuizAnalysis = _ref.getQuizAnalysis,
|
|
25
|
+
getItemAnalyses = _ref.getItemAnalyses;
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
var _useState = useState(null),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
quizAnalysis = _useState2[0],
|
|
30
|
+
setQuizAnalysis = _useState2[1];
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
var _useState3 = useState(null),
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
itemAnalyses = _useState4[0],
|
|
35
|
+
setItemAnalyses = _useState4[1];
|
|
36
|
+
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
var fetch = /*#__PURE__*/function () {
|
|
39
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
40
|
+
var quizAnalysis;
|
|
41
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
42
|
+
while (1) {
|
|
43
|
+
switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
_context.next = 2;
|
|
46
|
+
return getQuizAnalysis(activeQuizId);
|
|
47
|
+
|
|
48
|
+
case 2:
|
|
49
|
+
quizAnalysis = _context.sent;
|
|
50
|
+
setQuizAnalysis(quizAnalysis);
|
|
51
|
+
|
|
52
|
+
case 4:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
return function fetch() {
|
|
61
|
+
return _ref2.apply(this, arguments);
|
|
62
|
+
};
|
|
63
|
+
}();
|
|
64
|
+
|
|
65
|
+
fetch();
|
|
66
|
+
}, []);
|
|
67
|
+
useEffect(function () {
|
|
68
|
+
var fetch = /*#__PURE__*/function () {
|
|
69
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
70
|
+
var itemAnalyses;
|
|
71
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
72
|
+
while (1) {
|
|
73
|
+
switch (_context2.prev = _context2.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
_context2.next = 2;
|
|
76
|
+
return getItemAnalyses(activeQuizId);
|
|
77
|
+
|
|
78
|
+
case 2:
|
|
79
|
+
itemAnalyses = _context2.sent;
|
|
80
|
+
setItemAnalyses(itemAnalyses);
|
|
81
|
+
|
|
82
|
+
case 4:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, _callee2);
|
|
88
|
+
}));
|
|
36
89
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
return function fetch() {
|
|
91
|
+
return _ref3.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}();
|
|
94
|
+
|
|
95
|
+
fetch();
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
var renderContent = function renderContent() {
|
|
99
|
+
/* eslint-disable react/jsx-no-literals */
|
|
100
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "fs-mask"
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
103
|
+
level: "h2",
|
|
104
|
+
color: "primary"
|
|
105
|
+
}, quizAnalysis.metadata.quiz_title), _ref4, /*#__PURE__*/React.createElement(MetricGroup, null, /*#__PURE__*/React.createElement(Metric, {
|
|
106
|
+
key: "highscore",
|
|
107
|
+
renderLabel: "HIGH SCORE",
|
|
108
|
+
renderValue: quizAnalysis.scores.max_percentage
|
|
109
|
+
}), /*#__PURE__*/React.createElement(Metric, {
|
|
110
|
+
key: "lowscore",
|
|
111
|
+
renderLabel: "LOW SCORE",
|
|
112
|
+
renderValue: quizAnalysis.scores.min_percentage
|
|
113
|
+
}), /*#__PURE__*/React.createElement(Metric, {
|
|
114
|
+
key: "meanscore",
|
|
115
|
+
renderLabel: "MEAN SCORE",
|
|
116
|
+
renderValue: quizAnalysis.scores.mean_percentage
|
|
117
|
+
})), _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
118
|
+
return /*#__PURE__*/React.createElement(MetricGroup, {
|
|
119
|
+
key: itemAnalysis.metadata.item_id
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Metric, {
|
|
121
|
+
key: "itemdifficulty",
|
|
122
|
+
renderLabel: "ITEM DIFFICULTY",
|
|
123
|
+
renderValue: itemAnalysis.scores.difficulty
|
|
124
|
+
}), /*#__PURE__*/React.createElement(Metric, {
|
|
125
|
+
key: "responded",
|
|
126
|
+
renderLabel: "RESPONDED",
|
|
127
|
+
renderValue: itemAnalysis.attempts.students_responded
|
|
128
|
+
}), /*#__PURE__*/React.createElement(Metric, {
|
|
129
|
+
key: "skipped",
|
|
130
|
+
renderLabel: "SKIPPED/NO RESPONSE",
|
|
131
|
+
renderValue: itemAnalysis.attempts.students_without_response
|
|
132
|
+
}));
|
|
133
|
+
}));
|
|
134
|
+
/* eslint-enable react/jsx-no-literals */
|
|
135
|
+
}; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
|
|
136
|
+
// once it is known how will be such a case handled by the backend
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if (quizAnalysis && itemAnalyses) {
|
|
140
|
+
return renderContent();
|
|
141
|
+
} else {
|
|
142
|
+
return _ref6;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
67
145
|
NewQuizAndItemAnalysis.propTypes = {
|
|
68
|
-
quiz: ImmutablePropTypes.record.isRequired,
|
|
69
146
|
activeQuizId: PropTypes.string.isRequired,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
NewQuizAndItemAnalysis.defaultProps = {
|
|
74
|
-
locale: null
|
|
75
|
-
};
|
|
76
|
-
NewQuizAndItemAnalysis.contextTypes = {
|
|
77
|
-
locale: PropTypes.string
|
|
147
|
+
getQuizAnalysis: PropTypes.func.isRequired,
|
|
148
|
+
getItemAnalyses: PropTypes.func.isRequired
|
|
78
149
|
};
|
|
79
150
|
export default NewQuizAndItemAnalysis;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getItemAnalyses = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var getItemAnalyses = /*#__PURE__*/function () {
|
|
15
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(quizId) {
|
|
16
|
+
var response;
|
|
17
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
+
while (1) {
|
|
19
|
+
switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
_context.prev = 0;
|
|
22
|
+
_context.next = 3;
|
|
23
|
+
return fetch("http://".concat(window.ENV.API_HOST, "/api/quizzes/").concat(quizId, "/stats/new_item_analyses"));
|
|
24
|
+
|
|
25
|
+
case 3:
|
|
26
|
+
response = _context.sent;
|
|
27
|
+
_context.next = 6;
|
|
28
|
+
return response.json();
|
|
29
|
+
|
|
30
|
+
case 6:
|
|
31
|
+
return _context.abrupt("return", _context.sent);
|
|
32
|
+
|
|
33
|
+
case 9:
|
|
34
|
+
_context.prev = 9;
|
|
35
|
+
_context.t0 = _context["catch"](0);
|
|
36
|
+
console.error(_context.t0);
|
|
37
|
+
|
|
38
|
+
case 12:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, _callee, null, [[0, 9]]);
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
return function getItemAnalyses(_x) {
|
|
47
|
+
return _ref.apply(this, arguments);
|
|
48
|
+
};
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
exports.getItemAnalyses = getItemAnalyses;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getQuizAnalysis = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var getQuizAnalysis = /*#__PURE__*/function () {
|
|
15
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(quizId) {
|
|
16
|
+
var response;
|
|
17
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
+
while (1) {
|
|
19
|
+
switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
_context.prev = 0;
|
|
22
|
+
_context.next = 3;
|
|
23
|
+
return fetch("http://".concat(window.ENV.API_HOST, "/api/quizzes/").concat(quizId, "/stats/new_quiz_analysis"));
|
|
24
|
+
|
|
25
|
+
case 3:
|
|
26
|
+
response = _context.sent;
|
|
27
|
+
_context.next = 6;
|
|
28
|
+
return response.json();
|
|
29
|
+
|
|
30
|
+
case 6:
|
|
31
|
+
return _context.abrupt("return", _context.sent);
|
|
32
|
+
|
|
33
|
+
case 9:
|
|
34
|
+
_context.prev = 9;
|
|
35
|
+
_context.t0 = _context["catch"](0);
|
|
36
|
+
console.error(_context.t0);
|
|
37
|
+
|
|
38
|
+
case 12:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, _callee, null, [[0, 9]]);
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
return function getQuizAnalysis(_x) {
|
|
47
|
+
return _ref.apply(this, arguments);
|
|
48
|
+
};
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
exports.getQuizAnalysis = getQuizAnalysis;
|
|
@@ -10,20 +10,18 @@ var _presenter = require("./presenter.js");
|
|
|
10
10
|
|
|
11
11
|
var _reactRedux = require("../../../../common/react-redux.js");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _newQuizAnalysis = require("../../../api/newQuizAnalysis.js");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _newItemAnalyses = require("../../../api/newItemAnalyses.js");
|
|
16
16
|
|
|
17
|
-
function mapStateToProps(
|
|
18
|
-
var activeQuiz = (0, _quizzes.getActiveQuiz)(state);
|
|
17
|
+
function mapStateToProps(_state) {
|
|
19
18
|
return {
|
|
20
|
-
|
|
19
|
+
getQuizAnalysis: _newQuizAnalysis.getQuizAnalysis,
|
|
20
|
+
getItemAnalyses: _newItemAnalyses.getItemAnalyses
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var NewQuizAndItemAnalysis = (0, _reactRedux.connect)(mapStateToProps
|
|
25
|
-
getExistingQuiz: _quizzes2.getExistingQuiz
|
|
26
|
-
})(_presenter.NewQuizAndItemAnalysis);
|
|
24
|
+
var NewQuizAndItemAnalysis = (0, _reactRedux.connect)(mapStateToProps)(_presenter.NewQuizAndItemAnalysis);
|
|
27
25
|
exports.NewQuizAndItemAnalysis = NewQuizAndItemAnalysis;
|
|
28
26
|
var _default = NewQuizAndItemAnalysis;
|
|
29
27
|
exports.default = _default;
|
|
@@ -9,93 +9,163 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = exports.NewQuizAndItemAnalysis = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
17
|
|
|
20
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
24
|
-
var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
25
|
-
|
|
26
22
|
var _uiHeading = require("@instructure/ui-heading");
|
|
27
23
|
|
|
28
24
|
var _uiMetric = require("@instructure/ui-metric");
|
|
29
25
|
|
|
30
26
|
var _Spinner = _interopRequireDefault(require("../../../../common/components/shared/spinner/Spinner.js"));
|
|
31
27
|
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
var _ref4 = /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, {
|
|
29
|
+
level: "h3",
|
|
30
|
+
color: "primary"
|
|
31
|
+
}, "Quiz analysis");
|
|
32
|
+
|
|
33
|
+
var _ref5 = /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, {
|
|
34
|
+
level: "h3",
|
|
35
|
+
color: "primary"
|
|
36
|
+
}, "Item analysis");
|
|
37
|
+
|
|
38
|
+
var _ref6 = /*#__PURE__*/_react.default.createElement(_Spinner.default, null);
|
|
39
|
+
|
|
40
|
+
var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
|
|
41
|
+
var activeQuizId = _ref.activeQuizId,
|
|
42
|
+
getQuizAnalysis = _ref.getQuizAnalysis,
|
|
43
|
+
getItemAnalyses = _ref.getItemAnalyses;
|
|
44
|
+
|
|
45
|
+
var _useState = (0, _react.useState)(null),
|
|
46
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
+
quizAnalysis = _useState2[0],
|
|
48
|
+
setQuizAnalysis = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var _useState3 = (0, _react.useState)(null),
|
|
51
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
52
|
+
itemAnalyses = _useState4[0],
|
|
53
|
+
setItemAnalyses = _useState4[1];
|
|
54
|
+
|
|
55
|
+
(0, _react.useEffect)(function () {
|
|
56
|
+
var fetch = /*#__PURE__*/function () {
|
|
57
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
58
|
+
var quizAnalysis;
|
|
59
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
60
|
+
while (1) {
|
|
61
|
+
switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
_context.next = 2;
|
|
64
|
+
return getQuizAnalysis(activeQuizId);
|
|
65
|
+
|
|
66
|
+
case 2:
|
|
67
|
+
quizAnalysis = _context.sent;
|
|
68
|
+
setQuizAnalysis(quizAnalysis);
|
|
69
|
+
|
|
70
|
+
case 4:
|
|
71
|
+
case "end":
|
|
72
|
+
return _context.stop();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, _callee);
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
return function fetch() {
|
|
79
|
+
return _ref2.apply(this, arguments);
|
|
80
|
+
};
|
|
81
|
+
}();
|
|
82
|
+
|
|
83
|
+
fetch();
|
|
84
|
+
}, []);
|
|
85
|
+
(0, _react.useEffect)(function () {
|
|
86
|
+
var fetch = /*#__PURE__*/function () {
|
|
87
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
88
|
+
var itemAnalyses;
|
|
89
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
90
|
+
while (1) {
|
|
91
|
+
switch (_context2.prev = _context2.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
_context2.next = 2;
|
|
94
|
+
return getItemAnalyses(activeQuizId);
|
|
95
|
+
|
|
96
|
+
case 2:
|
|
97
|
+
itemAnalyses = _context2.sent;
|
|
98
|
+
setItemAnalyses(itemAnalyses);
|
|
99
|
+
|
|
100
|
+
case 4:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context2.stop();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, _callee2);
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
return function fetch() {
|
|
109
|
+
return _ref3.apply(this, arguments);
|
|
110
|
+
};
|
|
111
|
+
}();
|
|
112
|
+
|
|
113
|
+
fetch();
|
|
114
|
+
}, []);
|
|
115
|
+
|
|
116
|
+
var renderContent = function renderContent() {
|
|
117
|
+
/* eslint-disable react/jsx-no-literals */
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
+
className: "fs-mask"
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, {
|
|
121
|
+
level: "h2",
|
|
122
|
+
color: "primary"
|
|
123
|
+
}, quizAnalysis.metadata.quiz_title), _ref4, /*#__PURE__*/_react.default.createElement(_uiMetric.MetricGroup, null, /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
124
|
+
key: "highscore",
|
|
125
|
+
renderLabel: "HIGH SCORE",
|
|
126
|
+
renderValue: quizAnalysis.scores.max_percentage
|
|
127
|
+
}), /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
128
|
+
key: "lowscore",
|
|
129
|
+
renderLabel: "LOW SCORE",
|
|
130
|
+
renderValue: quizAnalysis.scores.min_percentage
|
|
131
|
+
}), /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
132
|
+
key: "meanscore",
|
|
133
|
+
renderLabel: "MEAN SCORE",
|
|
134
|
+
renderValue: quizAnalysis.scores.mean_percentage
|
|
135
|
+
})), _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_uiMetric.MetricGroup, {
|
|
137
|
+
key: itemAnalysis.metadata.item_id
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
139
|
+
key: "itemdifficulty",
|
|
140
|
+
renderLabel: "ITEM DIFFICULTY",
|
|
141
|
+
renderValue: itemAnalysis.scores.difficulty
|
|
142
|
+
}), /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
143
|
+
key: "responded",
|
|
144
|
+
renderLabel: "RESPONDED",
|
|
145
|
+
renderValue: itemAnalysis.attempts.students_responded
|
|
146
|
+
}), /*#__PURE__*/_react.default.createElement(_uiMetric.Metric, {
|
|
147
|
+
key: "skipped",
|
|
148
|
+
renderLabel: "SKIPPED/NO RESPONSE",
|
|
149
|
+
renderValue: itemAnalysis.attempts.students_without_response
|
|
150
|
+
}));
|
|
151
|
+
}));
|
|
152
|
+
/* eslint-enable react/jsx-no-literals */
|
|
153
|
+
}; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
|
|
154
|
+
// once it is known how will be such a case handled by the backend
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
if (quizAnalysis && itemAnalyses) {
|
|
158
|
+
return renderContent();
|
|
159
|
+
} else {
|
|
160
|
+
return _ref6;
|
|
55
161
|
}
|
|
56
|
-
|
|
57
|
-
(0, _createClass2.default)(NewQuizAndItemAnalysis, [{
|
|
58
|
-
key: "componentDidMount",
|
|
59
|
-
value: function componentDidMount() {
|
|
60
|
-
this.props.getExistingQuiz(this.props.activeQuizId);
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "renderContent",
|
|
64
|
-
value: function renderContent() {
|
|
65
|
-
var quiz = this.props.quiz;
|
|
66
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
-
className: "fs-mask"
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, {
|
|
69
|
-
level: "h3",
|
|
70
|
-
color: "primary"
|
|
71
|
-
}, quiz.title), _ref);
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "render",
|
|
75
|
-
value: function render() {
|
|
76
|
-
if (this.props.quiz.isLoaded()) {
|
|
77
|
-
return this.renderContent();
|
|
78
|
-
} else {
|
|
79
|
-
return _ref2;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}]);
|
|
83
|
-
NewQuizAndItemAnalysis.displayName = "NewQuizAndItemAnalysis";
|
|
84
|
-
return NewQuizAndItemAnalysis;
|
|
85
|
-
}((0, _quizCommon.withI18nSupport)(_react.Component));
|
|
162
|
+
};
|
|
86
163
|
|
|
87
164
|
exports.NewQuizAndItemAnalysis = NewQuizAndItemAnalysis;
|
|
88
165
|
NewQuizAndItemAnalysis.propTypes = {
|
|
89
|
-
quiz: _reactImmutableProptypes.default.record.isRequired,
|
|
90
166
|
activeQuizId: _propTypes.default.string.isRequired,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
NewQuizAndItemAnalysis.defaultProps = {
|
|
95
|
-
locale: null
|
|
96
|
-
};
|
|
97
|
-
NewQuizAndItemAnalysis.contextTypes = {
|
|
98
|
-
locale: _propTypes.default.string
|
|
167
|
+
getQuizAnalysis: _propTypes.default.func.isRequired,
|
|
168
|
+
getItemAnalyses: _propTypes.default.func.isRequired
|
|
99
169
|
};
|
|
100
170
|
var _default = NewQuizAndItemAnalysis;
|
|
101
171
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.50.2-rc.
|
|
3
|
+
"version": "17.50.2-rc.5+8cb254f33",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@instructure/outcomes-ui": "^2.1.
|
|
44
|
-
"@instructure/quiz-common": "17.50.2-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.50.2-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.50.2-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.50.2-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.50.2-rc.
|
|
43
|
+
"@instructure/outcomes-ui": "^2.1.6",
|
|
44
|
+
"@instructure/quiz-common": "17.50.2-rc.5+8cb254f33",
|
|
45
|
+
"@instructure/quiz-i18n": "17.50.2-rc.5+8cb254f33",
|
|
46
|
+
"@instructure/quiz-interactions": "17.50.2-rc.5+8cb254f33",
|
|
47
|
+
"@instructure/quiz-number-input": "17.50.2-rc.5+8cb254f33",
|
|
48
|
+
"@instructure/quiz-rce": "17.50.2-rc.5+8cb254f33",
|
|
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.50.2-rc.
|
|
109
|
+
"instructure-validations": "17.50.2-rc.5+8cb254f33",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"intl": "^1.2.4",
|
|
157
157
|
"jquery": "^2.2.3",
|
|
158
158
|
"most-subject": "^5.3.0",
|
|
159
|
-
"quiz-presets": "17.50.2-rc.
|
|
159
|
+
"quiz-presets": "17.50.2-rc.5+8cb254f33",
|
|
160
160
|
"react": "^16.8.6",
|
|
161
161
|
"react-addons-test-utils": "^15.6.2",
|
|
162
162
|
"react-dom": "^16.8.6",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"publishConfig": {
|
|
173
173
|
"access": "public"
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "8cb254f33e420bf80b2920f7dd400520fec05e35"
|
|
176
176
|
}
|