@instructure/quiz-core 22.16.0 → 22.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/banks/components/BankEntry/presenter.js +1 -1
- package/es/banks/components/SharingModal/presenter.js +1 -1
- package/es/building/api/quizEntries.js +25 -5
- package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/es/common/actions/modal.js +2 -1
- package/es/common/components/ApiFeatureFlagInitializer/index.js +1 -1
- package/es/common/components/ConfirmationModal/index.js +1 -1
- package/es/common/components/ConfirmationModal/presenter.js +49 -169
- package/es/common/components/RceConfigProvider/presenter.js +1 -1
- package/es/common/components/SDKApp/index.js +38 -39
- package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/es/common/components/resources/item/ItemEdit/index.js +5 -3
- package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/es/common/components/resources/item/ItemShow/index.js +2 -1
- package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/es/common/components/shared/PaginatedCollection/presenter.js +1 -1
- package/es/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/es/common/components/shared/spinner/Spinner.js +15 -16
- package/es/common/middleware/appSyncMiddleware.js +19 -0
- package/es/common/records/Quiz.js +8 -1
- package/es/common/records/QuizEntry.js +8 -1
- package/es/common/records/SessionItem.js +2 -1
- package/es/common/records/SessionItemResult.js +24 -0
- package/es/common/util/interactionTypePropsHelper.js +4 -2
- package/es/common/util/isMissing.js +4 -0
- package/es/configureStore.js +3 -1
- package/es/index.js +6 -4
- package/es/moderating/components/resources/ModerateTable/presenter.js +15 -10
- package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/es/reduxStore.js +4 -0
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- package/es/taking/api/taking.js +45 -10
- package/lib/banks/components/BankEntry/presenter.js +1 -1
- package/lib/banks/components/SharingModal/presenter.js +1 -1
- package/lib/building/api/quizEntries.js +25 -5
- package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/lib/common/actions/modal.js +2 -1
- package/lib/common/components/ApiFeatureFlagInitializer/index.js +1 -1
- package/lib/common/components/ConfirmationModal/index.js +1 -1
- package/lib/common/components/ConfirmationModal/presenter.js +49 -169
- package/lib/common/components/RceConfigProvider/presenter.js +1 -1
- package/lib/common/components/SDKApp/index.js +38 -39
- package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
- package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/lib/common/components/resources/item/ItemShow/index.js +2 -1
- package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/lib/common/components/shared/PaginatedCollection/presenter.js +1 -1
- package/lib/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/lib/common/components/shared/spinner/Spinner.js +15 -16
- package/lib/common/middleware/appSyncMiddleware.js +19 -0
- package/lib/common/records/Quiz.js +8 -1
- package/lib/common/records/QuizEntry.js +8 -1
- package/lib/common/records/SessionItem.js +2 -1
- package/lib/common/records/SessionItemResult.js +24 -0
- package/lib/common/util/interactionTypePropsHelper.js +4 -2
- package/lib/common/util/isMissing.js +4 -0
- package/lib/configureStore.js +3 -1
- package/lib/index.js +6 -4
- package/lib/moderating/components/resources/ModerateTable/presenter.js +15 -10
- package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/lib/reduxStore.js +4 -0
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- package/lib/taking/api/taking.js +45 -10
- package/package.json +10 -10
- package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import { Flex } from '@instructure/quiz-common';
|
|
5
|
+
import { Progress } from './components/Progress';
|
|
6
|
+
import { PointsDisplay } from './components/PointsDisplay';
|
|
7
|
+
import { LetterGrade } from './components/LetterGrade';
|
|
8
|
+
import { UNKNOWN_PERCENTAGE_VALUE } from '../../../../../util/isMissing';
|
|
9
|
+
export var ScoreDisplay = function(param) {
|
|
10
|
+
var isSurvey = param.isSurvey, restrictQuantitativeData = param.restrictQuantitativeData, quizSessionResult = param.quizSessionResult, gradingScheme = param.gradingScheme;
|
|
11
|
+
if (isSurvey) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var ratio = quizSessionResult.percentage;
|
|
15
|
+
var percentage = isNaN(ratio) ? UNKNOWN_PERCENTAGE_VALUE : ratio;
|
|
16
|
+
if (restrictQuantitativeData) {
|
|
17
|
+
return /*#__PURE__*/ React.createElement(LetterGrade, {
|
|
18
|
+
percentage: percentage,
|
|
19
|
+
gradingScheme: gradingScheme
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
23
|
+
wrap: "wrap",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyItems: "start"
|
|
26
|
+
}, /*#__PURE__*/ React.createElement(Flex.Item, {
|
|
27
|
+
shouldGrow: true,
|
|
28
|
+
shouldShrink: true
|
|
29
|
+
}, /*#__PURE__*/ React.createElement(Progress, {
|
|
30
|
+
percentage: percentage,
|
|
31
|
+
points: quizSessionResult.score,
|
|
32
|
+
pointsPossible: quizSessionResult.pointsPossible
|
|
33
|
+
})), /*#__PURE__*/ React.createElement(Flex.Item, {
|
|
34
|
+
shouldGrow: true,
|
|
35
|
+
shouldShrink: true
|
|
36
|
+
}, /*#__PURE__*/ React.createElement(PointsDisplay, {
|
|
37
|
+
points: quizSessionResult.score,
|
|
38
|
+
pointsPossible: quizSessionResult.pointsPossible
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
41
|
+
ScoreDisplay.propTypes = {
|
|
42
|
+
isSurvey: PropTypes.bool.isRequired,
|
|
43
|
+
restrictQuantitativeData: PropTypes.bool,
|
|
44
|
+
quizSessionResult: ImmutablePropTypes.record,
|
|
45
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
46
|
+
name: PropTypes.string,
|
|
47
|
+
value: PropTypes.number
|
|
48
|
+
}))
|
|
49
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** @jsx jsx */ import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import { AccessibleContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
5
|
+
import { Alert } from '@instructure/ui-alerts';
|
|
6
|
+
import { Text } from '@instructure/ui-text';
|
|
7
|
+
import { Heading } from '@instructure/ui-heading';
|
|
8
|
+
import { View } from '@instructure/ui-view';
|
|
9
|
+
import { jsx } from '@instructure/emotion';
|
|
10
|
+
import { Flex } from '@instructure/quiz-common';
|
|
11
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
12
|
+
import FormattedDuration from '../../../shared/FormattedDuration';
|
|
13
|
+
import { formatTime } from '../../../../util/formatTimespan';
|
|
14
|
+
import { ScoreDisplay } from './ScoreDisplay/index';
|
|
15
|
+
function GradingAlerts(param) {
|
|
16
|
+
var quizSessionResult = param.quizSessionResult, sessionItemResults = param.sessionItemResults;
|
|
17
|
+
var alerts = [];
|
|
18
|
+
if (quizSessionResult.isLoaded() && quizSessionResult.autogradingFailed()) {
|
|
19
|
+
var msg = t('There was a grading problem. Please inform your instructor.');
|
|
20
|
+
alerts.push(/*#__PURE__*/ jsx(Alert, {
|
|
21
|
+
key: "autograding_failed",
|
|
22
|
+
variant: "warning"
|
|
23
|
+
}, msg));
|
|
24
|
+
}
|
|
25
|
+
var ungradedCount = sessionItemResults.reduce(function(count, sessionItemResult) {
|
|
26
|
+
return sessionItemResult.getIn([
|
|
27
|
+
'scoredData',
|
|
28
|
+
'gradeStatus'
|
|
29
|
+
]) === 'waiting' ? count + 1 : count;
|
|
30
|
+
}, 0);
|
|
31
|
+
if (ungradedCount > 0 && quizSessionResult.isLoaded()) {
|
|
32
|
+
var ungradedText = t("{\n count, plural,\n one {# question requires grading}\n other {# questions require grading}\n }", {
|
|
33
|
+
count: ungradedCount
|
|
34
|
+
});
|
|
35
|
+
alerts.push(/*#__PURE__*/ jsx(Alert, {
|
|
36
|
+
key: "manual_grading",
|
|
37
|
+
variant: "info"
|
|
38
|
+
}, ungradedText));
|
|
39
|
+
}
|
|
40
|
+
if (alerts.length === 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
44
|
+
direction: "row",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyItems: "center",
|
|
47
|
+
margin: "x-small 0 0 0"
|
|
48
|
+
}, /*#__PURE__*/ jsx(Flex.Item, {
|
|
49
|
+
"data-automation": "sdk-results-requires-grading",
|
|
50
|
+
shouldGrow: false,
|
|
51
|
+
shouldShrink: true,
|
|
52
|
+
size: "33rem"
|
|
53
|
+
}, alerts));
|
|
54
|
+
}
|
|
55
|
+
function ElapsedTime(param) {
|
|
56
|
+
var elapsedTime = param.elapsedTime;
|
|
57
|
+
var attemptText = t('Time for this attempt');
|
|
58
|
+
var alt = t('Time for this attempt: { time }', {
|
|
59
|
+
time: formatTime(elapsedTime)
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/ jsx(AccessibleContent, {
|
|
62
|
+
alt: alt
|
|
63
|
+
}, /*#__PURE__*/ jsx(View, {
|
|
64
|
+
as: "div"
|
|
65
|
+
}, /*#__PURE__*/ jsx(FormattedDuration, {
|
|
66
|
+
fontSize: "xx-large",
|
|
67
|
+
fontWeight: "bold",
|
|
68
|
+
seconds: elapsedTime
|
|
69
|
+
})), /*#__PURE__*/ jsx(Text, {
|
|
70
|
+
color: "secondary"
|
|
71
|
+
}, attemptText));
|
|
72
|
+
}
|
|
73
|
+
export function QuizSessionResultInfo(param) {
|
|
74
|
+
var _param_gradingScheme = param.gradingScheme, gradingScheme = _param_gradingScheme === void 0 ? [] : _param_gradingScheme, quizSession = param.quizSession, quizSessionResult = param.quizSessionResult, sessionItemResults = param.sessionItemResults, _param_restrictQuantitativeData = param.restrictQuantitativeData, restrictQuantitativeData = _param_restrictQuantitativeData === void 0 ? false : _param_restrictQuantitativeData, isSurvey = param.isSurvey;
|
|
75
|
+
return /*#__PURE__*/ jsx(View, null, /*#__PURE__*/ jsx(GradingAlerts, {
|
|
76
|
+
quizSessionResult: quizSessionResult,
|
|
77
|
+
sessionItemResults: sessionItemResults
|
|
78
|
+
}), /*#__PURE__*/ jsx(Flex, {
|
|
79
|
+
padding: "none",
|
|
80
|
+
margin: "none",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
justifyItems: "center"
|
|
83
|
+
}, /*#__PURE__*/ jsx(Flex, {
|
|
84
|
+
wrap: "wrap",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyItems: "center",
|
|
87
|
+
className: "fs-mask"
|
|
88
|
+
}, /*#__PURE__*/ jsx(ScreenReaderContent, null, /*#__PURE__*/ jsx(Heading, {
|
|
89
|
+
level: "h2"
|
|
90
|
+
}, t('Assessment Statistics'))), /*#__PURE__*/ jsx(Flex.Item, {
|
|
91
|
+
shouldGrow: true,
|
|
92
|
+
shouldShrink: true
|
|
93
|
+
}, /*#__PURE__*/ jsx(ScoreDisplay, {
|
|
94
|
+
isSurvey: isSurvey,
|
|
95
|
+
restrictQuantitativeData: restrictQuantitativeData,
|
|
96
|
+
gradingScheme: gradingScheme,
|
|
97
|
+
quizSessionResult: quizSessionResult
|
|
98
|
+
})), /*#__PURE__*/ jsx(Flex.Item, {
|
|
99
|
+
shouldGrow: true,
|
|
100
|
+
shouldShrink: true,
|
|
101
|
+
margin: "small",
|
|
102
|
+
padding: "0 0 0 small"
|
|
103
|
+
}, /*#__PURE__*/ jsx(ElapsedTime, {
|
|
104
|
+
elapsedTime: quizSession.elapsedTime
|
|
105
|
+
})))));
|
|
106
|
+
}
|
|
107
|
+
QuizSessionResultInfo.propTypes = {
|
|
108
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
109
|
+
name: PropTypes.string,
|
|
110
|
+
value: PropTypes.number
|
|
111
|
+
})),
|
|
112
|
+
quizSession: ImmutablePropTypes.record.isRequired,
|
|
113
|
+
quizSessionResult: ImmutablePropTypes.record.isRequired,
|
|
114
|
+
restrictQuantitativeData: PropTypes.bool,
|
|
115
|
+
sessionItemResults: ImmutablePropTypes.list.isRequired,
|
|
116
|
+
styles: PropTypes.object,
|
|
117
|
+
isSurvey: PropTypes.bool.isRequired
|
|
118
|
+
};
|
|
@@ -13,7 +13,7 @@ import { addError, screenreaderNotification } from '../../../../actions/alerts';
|
|
|
13
13
|
import { updateItem } from '../../../../../building/api/items';
|
|
14
14
|
import { interactionFileUpload, setOneAtATimeType } from '../../../../../building/api/quizzes';
|
|
15
15
|
import { featureOn } from '../../../../util/featureCheck';
|
|
16
|
-
import {
|
|
16
|
+
import { getActiveQuiz, isActiveQuizWorkingInstanceOneQuestionAtATime } from '../../../../selectors/quizzes';
|
|
17
17
|
export function mapStateToProps(state, props) {
|
|
18
18
|
// Error Related:
|
|
19
19
|
var workingItem = props.entry.getWorkingInstance();
|
|
@@ -25,6 +25,7 @@ export function mapStateToProps(state, props) {
|
|
|
25
25
|
'outcomes',
|
|
26
26
|
'contextUuid'
|
|
27
27
|
]) : props.contextUuid;
|
|
28
|
+
var quiz = getActiveQuiz(state);
|
|
28
29
|
var _props_showCalculator;
|
|
29
30
|
return {
|
|
30
31
|
answerFeedbackEnabled: featureOn('answer_level_feedback'),
|
|
@@ -50,13 +51,14 @@ export function mapStateToProps(state, props) {
|
|
|
50
51
|
]),
|
|
51
52
|
partialDeepScoringEnabled: featureOn('partial_deep_scoring'),
|
|
52
53
|
partialScoringEnabled: featureOn('partial_scoring'),
|
|
53
|
-
quizId:
|
|
54
|
+
quizId: quiz.id,
|
|
54
55
|
scope: props.scope,
|
|
55
56
|
rootAccountUuid: state.getIn([
|
|
56
57
|
'outcomes',
|
|
57
58
|
'externalAccountUuid'
|
|
58
59
|
]),
|
|
59
|
-
showCalculatorOption: (_props_showCalculator = props.showCalculator) !== null && _props_showCalculator !== void 0 ? _props_showCalculator : true
|
|
60
|
+
showCalculatorOption: (_props_showCalculator = props.showCalculator) !== null && _props_showCalculator !== void 0 ? _props_showCalculator : true,
|
|
61
|
+
isSurvey: quiz.isSurvey()
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
function mapDispatchToProps(dispatch) {
|
|
@@ -185,7 +185,7 @@ export var ItemEdit = /*#__PURE__*/ function(Component) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
var options = [];
|
|
188
|
-
if (this.props.outcomesEndpoint) {
|
|
188
|
+
if (!this.props.isSurvey && this.props.outcomesEndpoint) {
|
|
189
189
|
options.push({
|
|
190
190
|
key: 'outcomes',
|
|
191
191
|
title: /*#__PURE__*/ React.createElement("span", null, t('Align to Outcomes'), /*#__PURE__*/ React.createElement(OutcomeCount, _object_spread_props(_object_spread({
|
|
@@ -295,7 +295,8 @@ _define_property(ItemEdit, "propTypes", {
|
|
|
295
295
|
separatorConfig: PropTypes.shape({
|
|
296
296
|
decimalSeparator: PropTypes.string,
|
|
297
297
|
thousandSeparator: PropTypes.string
|
|
298
|
-
})
|
|
298
|
+
}),
|
|
299
|
+
isSurvey: PropTypes.bool.isRequired
|
|
299
300
|
});
|
|
300
301
|
_define_property(ItemEdit, "defaultProps", {
|
|
301
302
|
additionalOptions: [],
|
|
@@ -160,7 +160,8 @@ _define_property(ItemShow, "propTypes", {
|
|
|
160
160
|
separatorConfig: PropTypes.shape({
|
|
161
161
|
decimalSeparator: PropTypes.string,
|
|
162
162
|
thousandSeparator: PropTypes.string
|
|
163
|
-
})
|
|
163
|
+
}),
|
|
164
|
+
isSurvey: PropTypes.bool.isRequired
|
|
164
165
|
});
|
|
165
166
|
_define_property(ItemShow, "defaultProps", {
|
|
166
167
|
switchOnEditing: null
|
|
@@ -4,12 +4,14 @@ import { set } from '../../../../../actions/ui';
|
|
|
4
4
|
import { screenreaderNotification } from '../../../../../actions/alerts';
|
|
5
5
|
import AddContentBody from './presenter';
|
|
6
6
|
import { getInteractionTypes } from '../../../../../selectors/interactionTypes';
|
|
7
|
-
import { isEditingQuizEntry, getQuizEntryWithErrorsShowing } from '../../../../../selectors/quizzes';
|
|
7
|
+
import { isEditingQuizEntry, getQuizEntryWithErrorsShowing, getActiveQuiz } from '../../../../../selectors/quizzes';
|
|
8
8
|
var mapStateToProps = function(state) {
|
|
9
|
+
var activeQuiz = getActiveQuiz(state);
|
|
9
10
|
return {
|
|
10
11
|
editingQuizEntry: isEditingQuizEntry(state),
|
|
11
12
|
interactionTypes: getInteractionTypes(state),
|
|
12
|
-
quizEntryWithErrorsShowing: getQuizEntryWithErrorsShowing(state)
|
|
13
|
+
quizEntryWithErrorsShowing: getQuizEntryWithErrorsShowing(state),
|
|
14
|
+
isSurvey: activeQuiz.isSurvey()
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
var mapDispatchToProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */ import { jsx } from '@instructure/emotion';
|
|
2
2
|
import { BUILD_TRAY_OPEN, BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID, withStyleOverrides } from '@instructure/quiz-common';
|
|
3
3
|
import t from '@instructure/quiz-i18n/format-message';
|
|
4
|
-
import { Button, IconButton } from '@instructure/ui-buttons';
|
|
4
|
+
import { Button, IconButton, CloseButton } from '@instructure/ui-buttons';
|
|
5
5
|
import { Grid } from '@instructure/ui-grid';
|
|
6
6
|
import { IconAiSolid, IconBankLine } from '@instructure/ui-icons';
|
|
7
7
|
import { Text } from '@instructure/ui-text';
|
|
@@ -14,7 +14,9 @@ import InteractionTypes from '../../../../shared/InteractionTypes';
|
|
|
14
14
|
import generateStyle from './styles';
|
|
15
15
|
import generateComponentTheme from './theme';
|
|
16
16
|
function UnstyledAddContentBody(param) {
|
|
17
|
-
var allowStimulusCreation = param.allowStimulusCreation, createItem = param.createItem, createStimulus = param.createStimulus, editingQuizEntry = param.editingQuizEntry, interactionTypes = param.interactionTypes, _param_onOpenBankTray = param.onOpenBankTray, onOpenBankTray = _param_onOpenBankTray === void 0 ? function() {} : _param_onOpenBankTray, _param_onAddItem = param.onAddItem, onAddItem = _param_onAddItem === void 0 ? function() {} : _param_onAddItem, parentEntryId = param.parentEntryId, position = param.position, quizEntryWithErrorsShowing = param.quizEntryWithErrorsShowing, quizId = param.quizId, screenreaderNotification = param.screenreaderNotification, setNextQuizEntry = param.setNextQuizEntry, setUi = param.setUi, _param_showHeaderText = param.showHeaderText, showHeaderText = _param_showHeaderText === void 0 ? true : _param_showHeaderText, stimulusId = param.stimulusId, styles = param.styles, _param_slotProps = param.slotProps, slotProps = _param_slotProps === void 0 ? {} : _param_slotProps, _param_containerType = param.containerType, containerType = _param_containerType === void 0 ? 'popover' : _param_containerType
|
|
17
|
+
var allowStimulusCreation = param.allowStimulusCreation, createItem = param.createItem, createStimulus = param.createStimulus, editingQuizEntry = param.editingQuizEntry, interactionTypes = param.interactionTypes, _param_isSurvey = param.isSurvey, isSurvey = _param_isSurvey === void 0 ? false : _param_isSurvey, _param_onOpenBankTray = param.onOpenBankTray, onOpenBankTray = _param_onOpenBankTray === void 0 ? function() {} : _param_onOpenBankTray, _param_onAddItem = param.onAddItem, onAddItem = _param_onAddItem === void 0 ? function() {} : _param_onAddItem, parentEntryId = param.parentEntryId, position = param.position, quizEntryWithErrorsShowing = param.quizEntryWithErrorsShowing, quizId = param.quizId, screenreaderNotification = param.screenreaderNotification, setNextQuizEntry = param.setNextQuizEntry, setUi = param.setUi, _param_showHeaderText = param.showHeaderText, showHeaderText = _param_showHeaderText === void 0 ? true : _param_showHeaderText, stimulusId = param.stimulusId, styles = param.styles, _param_slotProps = param.slotProps, slotProps = _param_slotProps === void 0 ? {} : _param_slotProps, _param_containerType = param.containerType, containerType = _param_containerType === void 0 ? 'popover' : _param_containerType, _param_renderCloseButton = param.// Close button is only shown when the popover is rendered standalone.
|
|
18
|
+
// Defaults to false to avoid showing two close buttons when inside a modal(especially on smaller screens).
|
|
19
|
+
renderCloseButton, renderCloseButton = _param_renderCloseButton === void 0 ? false : _param_renderCloseButton;
|
|
18
20
|
var openBankTray = useCallback(function() {
|
|
19
21
|
onOpenBankTray();
|
|
20
22
|
setUi(BUILD_TRAY_OPEN, true);
|
|
@@ -26,6 +28,11 @@ function UnstyledAddContentBody(param) {
|
|
|
26
28
|
position,
|
|
27
29
|
parentEntryId
|
|
28
30
|
]);
|
|
31
|
+
var handleClose = useCallback(function() {
|
|
32
|
+
onAddItem();
|
|
33
|
+
}, [
|
|
34
|
+
onAddItem
|
|
35
|
+
]);
|
|
29
36
|
var addStimulus = useCallback(function(isPassage) {
|
|
30
37
|
if (editingQuizEntry) {
|
|
31
38
|
setNextQuizEntry(null, quizId, position);
|
|
@@ -89,15 +96,25 @@ function UnstyledAddContentBody(param) {
|
|
|
89
96
|
var text = showHeaderText ? t('Insert Content') : '';
|
|
90
97
|
return /*#__PURE__*/ jsx("div", {
|
|
91
98
|
css: styles.popoverHeaderBox
|
|
92
|
-
}, /*#__PURE__*/ jsx(
|
|
99
|
+
}, renderCloseButton && /*#__PURE__*/ jsx(View, {
|
|
100
|
+
as: "span",
|
|
101
|
+
display: "inline-block",
|
|
102
|
+
css: styles.closeButton
|
|
103
|
+
}, /*#__PURE__*/ jsx(CloseButton, {
|
|
104
|
+
screenReaderLabel: t('Close Insert Content'),
|
|
105
|
+
onClick: handleClose
|
|
106
|
+
})), /*#__PURE__*/ jsx("div", {
|
|
93
107
|
css: styles.popoverHeader
|
|
94
108
|
}, /*#__PURE__*/ jsx(Grid, {
|
|
95
109
|
vAlign: "middle",
|
|
96
110
|
colSpacing: "none",
|
|
97
111
|
rowSpacing: "none"
|
|
98
|
-
}, /*#__PURE__*/ jsx(Grid.Row, null, /*#__PURE__*/ jsx(Grid.Col, null, /*#__PURE__*/ jsx(
|
|
112
|
+
}, /*#__PURE__*/ jsx(Grid.Row, null, /*#__PURE__*/ jsx(Grid.Col, null, /*#__PURE__*/ jsx(View, {
|
|
113
|
+
as: "div",
|
|
114
|
+
margin: "medium 0"
|
|
115
|
+
}, /*#__PURE__*/ jsx(Text, {
|
|
99
116
|
color: "primary"
|
|
100
|
-
}, text)), /*#__PURE__*/ jsx(Grid.Col, {
|
|
117
|
+
}, text))), !isSurvey && /*#__PURE__*/ jsx(Grid.Col, {
|
|
101
118
|
width: "auto"
|
|
102
119
|
}, renderBankButton())))), ((_slotProps_quizGenerationButton = slotProps.quizGenerationButton) === null || _slotProps_quizGenerationButton === void 0 ? void 0 : _slotProps_quizGenerationButton.visible) && /*#__PURE__*/ jsx(View, {
|
|
103
120
|
as: "div",
|
|
@@ -142,6 +159,7 @@ AddContentBody.propTypes = {
|
|
|
142
159
|
createStimulus: PropTypes.func.isRequired,
|
|
143
160
|
editingQuizEntry: PropTypes.bool,
|
|
144
161
|
interactionTypes: ImmutablePropTypes.list,
|
|
162
|
+
isSurvey: PropTypes.bool,
|
|
145
163
|
onOpenBankTray: PropTypes.func,
|
|
146
164
|
onAddItem: PropTypes.func,
|
|
147
165
|
parentEntryId: PropTypes.string,
|
|
@@ -156,6 +174,7 @@ AddContentBody.propTypes = {
|
|
|
156
174
|
styles: PropTypes.object,
|
|
157
175
|
slotProps: PropTypes.shape({
|
|
158
176
|
quizGenerationButton: quizGenerationButtonPropTypes
|
|
159
|
-
})
|
|
177
|
+
}),
|
|
178
|
+
renderCloseButton: PropTypes.bool
|
|
160
179
|
};
|
|
161
180
|
export default AddContentBody;
|
|
@@ -18,8 +18,15 @@ var generateStyle = function(componentTheme) {
|
|
|
18
18
|
var _obj;
|
|
19
19
|
return {
|
|
20
20
|
popoverHeaderBox: {
|
|
21
|
+
position: 'relative',
|
|
21
22
|
borderBottom: "solid ".concat(componentTheme.popoverHeaderBoxBorderWidth, " ").concat(componentTheme.popoverHeaderBoxBorderColor)
|
|
22
23
|
},
|
|
24
|
+
closeButton: {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: '-0.8rem',
|
|
27
|
+
right: '-1.3rem',
|
|
28
|
+
zIndex: 1
|
|
29
|
+
},
|
|
23
30
|
popoverHeader: {
|
|
24
31
|
margin: '1rem',
|
|
25
32
|
marginBottom: '0.25rem'
|
|
@@ -120,6 +120,7 @@ function UnstyledAddContentPopover(param) {
|
|
|
120
120
|
shouldContainFocus: true,
|
|
121
121
|
renderTrigger: renderAddContentButton()
|
|
122
122
|
}, /*#__PURE__*/ jsx(AddContentBody, {
|
|
123
|
+
renderCloseButton: true,
|
|
123
124
|
allowStimulusCreation: allowStimulusCreation,
|
|
124
125
|
onOpenBankTray: switchOffEditing,
|
|
125
126
|
onAddItem: switchOffEditing,
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** @jsx jsx */ import React from 'react';
|
|
2
|
+
import { jsx } from '@instructure/emotion';
|
|
3
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
4
|
+
import { View } from '@instructure/ui-view';
|
|
5
|
+
import { Text } from '@instructure/ui-text';
|
|
6
|
+
import { Flex } from '@instructure/quiz-common';
|
|
7
|
+
import PositionBox from '../../../positionBox/PositionBox';
|
|
8
|
+
import { isMissing } from '../../../../../util/isMissing';
|
|
9
|
+
import { InteractionTypeName } from '../../../../../../building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader';
|
|
10
|
+
function PositionBoxScreenReaderContent(param) {
|
|
11
|
+
var questionNumber = param.questionNumber, unscorable = param.unscorable, regraded = param.regraded, editGraderFeedback = param.editGraderFeedback;
|
|
12
|
+
if (regraded && unscorable) {
|
|
13
|
+
return t('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
|
|
14
|
+
questionNumber: questionNumber
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (regraded) {
|
|
18
|
+
return t('Results for question {questionNumber, number}. This question has been regraded.', {
|
|
19
|
+
questionNumber: questionNumber
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (unscorable) {
|
|
23
|
+
if (editGraderFeedback) {
|
|
24
|
+
return t('Results for question {questionNumber, number}. There was a problem grading this question.', {
|
|
25
|
+
questionNumber: questionNumber
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return t('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
|
|
29
|
+
questionNumber: questionNumber
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return t('Results for question {questionNumber, number}.', {
|
|
33
|
+
questionNumber: questionNumber
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function RegradePoints(param) {
|
|
37
|
+
var sessionItemResult = param.sessionItemResult;
|
|
38
|
+
return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(View, {
|
|
39
|
+
as: "span",
|
|
40
|
+
size: "small",
|
|
41
|
+
margin: "small"
|
|
42
|
+
}, /*#__PURE__*/ jsx(Text, {
|
|
43
|
+
color: "secondary"
|
|
44
|
+
}, t("Previous score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
|
|
45
|
+
points: sessionItemResult.regradeInfo.get('originalScore') || 0,
|
|
46
|
+
possible: sessionItemResult.regradeInfo.get('originalPointsPossible')
|
|
47
|
+
}))), /*#__PURE__*/ jsx(View, {
|
|
48
|
+
as: "span",
|
|
49
|
+
size: "small",
|
|
50
|
+
margin: "small"
|
|
51
|
+
}, /*#__PURE__*/ jsx(Text, {
|
|
52
|
+
color: "alert"
|
|
53
|
+
}, t("Regrade score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
|
|
54
|
+
points: sessionItemResult.regradeInfo.get('newScore') || 0,
|
|
55
|
+
possible: sessionItemResult.regradeInfo.get('newPointsPossible')
|
|
56
|
+
}))));
|
|
57
|
+
}
|
|
58
|
+
function getPointsText(param) {
|
|
59
|
+
var sessionItemResult = param.sessionItemResult;
|
|
60
|
+
var points = sessionItemResult.score;
|
|
61
|
+
var pointsPossible = sessionItemResult.pointsPossible;
|
|
62
|
+
var pointsPresent = !isMissing(points);
|
|
63
|
+
var pointsPossiblePresent = !isMissing(pointsPossible);
|
|
64
|
+
if (pointsPresent && pointsPossiblePresent) {
|
|
65
|
+
return t("{ possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
|
|
66
|
+
points: points,
|
|
67
|
+
possible: pointsPossible
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (pointsPossiblePresent) {
|
|
71
|
+
return t("{ possible, plural,\n one {# point}\n other {# points}\n } possible", {
|
|
72
|
+
possible: pointsPossible
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (pointsPresent) {
|
|
76
|
+
return t("{ points, plural,\n one {# point}\n other {# points}\n } earned", {
|
|
77
|
+
points: points
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
function Points(param) {
|
|
83
|
+
var sessionItemResult = param.sessionItemResult;
|
|
84
|
+
if (sessionItemResult && sessionItemResult.hasRegradeInfo()) {
|
|
85
|
+
return /*#__PURE__*/ jsx(RegradePoints, {
|
|
86
|
+
sessionItemResult: sessionItemResult
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return /*#__PURE__*/ jsx(View, null, /*#__PURE__*/ jsx(Text, {
|
|
90
|
+
color: "secondary",
|
|
91
|
+
size: "small",
|
|
92
|
+
className: "fs-mask"
|
|
93
|
+
}, getPointsText({
|
|
94
|
+
sessionItemResult: sessionItemResult
|
|
95
|
+
})));
|
|
96
|
+
}
|
|
97
|
+
export function SessionItemResultHeader(param) {
|
|
98
|
+
var sessionItemResult = param.sessionItemResult, questionNumber = param.questionNumber, editGraderFeedback = param.editGraderFeedback, restrictQuantitativeData = param.restrictQuantitativeData, interactionTypeName = param.interactionTypeName;
|
|
99
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
100
|
+
direction: "row",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
gap: "small"
|
|
103
|
+
}, /*#__PURE__*/ jsx(PositionBox, {
|
|
104
|
+
position: questionNumber,
|
|
105
|
+
headingLevel: "h3",
|
|
106
|
+
headingText: PositionBoxScreenReaderContent({
|
|
107
|
+
questionNumber: questionNumber,
|
|
108
|
+
regraded: sessionItemResult.isRegraded(),
|
|
109
|
+
unscorable: sessionItemResult.isUnscorable(),
|
|
110
|
+
editGraderFeedback: editGraderFeedback
|
|
111
|
+
})
|
|
112
|
+
}), !restrictQuantitativeData && /*#__PURE__*/ jsx(Points, {
|
|
113
|
+
restrictQuantitativeData: restrictQuantitativeData,
|
|
114
|
+
sessionItemResult: sessionItemResult
|
|
115
|
+
}), /*#__PURE__*/ jsx(InteractionTypeName, {
|
|
116
|
+
name: interactionTypeName,
|
|
117
|
+
defaultValue: null,
|
|
118
|
+
textProps: {
|
|
119
|
+
size: 'small'
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
@@ -3,13 +3,17 @@ import { connect } from '../../../../react-redux';
|
|
|
3
3
|
import makeScrollable from '../../../shared/functionality/makeScrollable';
|
|
4
4
|
import { SessionItemResult as SessionItemResultPresenter } from './presenter';
|
|
5
5
|
import { featureOn } from '../../../../util/featureCheck';
|
|
6
|
-
|
|
6
|
+
import { getActiveQuiz } from '../../../../selectors/quizzes';
|
|
7
|
+
function mapStateToProps(state, ownProps) {
|
|
8
|
+
var quiz = getActiveQuiz(state);
|
|
9
|
+
var isSurvey = quiz === null || quiz === void 0 ? void 0 : quiz.isSurvey();
|
|
7
10
|
return {
|
|
8
11
|
itemResultsModifications: state.getIn([
|
|
9
12
|
'modifications',
|
|
10
13
|
'sessionItemResults'
|
|
11
14
|
]),
|
|
12
|
-
shouldRenderAnswerFeedback: featureOn('answer_level_feedback')
|
|
15
|
+
shouldRenderAnswerFeedback: featureOn('answer_level_feedback'),
|
|
16
|
+
isSurvey: isSurvey
|
|
13
17
|
};
|
|
14
18
|
}
|
|
15
19
|
export var SessionItemResult = compose(connect(mapStateToProps), makeScrollable)(SessionItemResultPresenter);
|