@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.
Files changed (159) hide show
  1. package/es/banks/components/BankEntry/presenter.js +1 -1
  2. package/es/banks/components/SharingModal/presenter.js +1 -1
  3. package/es/building/api/quizEntries.js +25 -5
  4. package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
  5. package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  6. package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
  7. package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  8. package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  9. package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  10. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  11. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  12. package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  13. package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  14. package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  15. package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  16. package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  17. package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  18. package/es/common/actions/modal.js +2 -1
  19. package/es/common/components/ApiFeatureFlagInitializer/index.js +1 -1
  20. package/es/common/components/ConfirmationModal/index.js +1 -1
  21. package/es/common/components/ConfirmationModal/presenter.js +49 -169
  22. package/es/common/components/RceConfigProvider/presenter.js +1 -1
  23. package/es/common/components/SDKApp/index.js +38 -39
  24. package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  25. package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
  26. package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  27. package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  28. package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  29. package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  30. package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  31. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  32. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  33. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  34. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  35. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  36. package/es/common/components/resources/item/ItemEdit/index.js +5 -3
  37. package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
  38. package/es/common/components/resources/item/ItemShow/index.js +2 -1
  39. package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  40. package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  41. package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  42. package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  43. package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  44. package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  45. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  46. package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  47. package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
  48. package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  49. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  50. package/es/common/components/shared/PaginatedCollection/presenter.js +1 -1
  51. package/es/common/components/shared/PrintTrigger/presenter.js +1 -1
  52. package/es/common/components/shared/spinner/Spinner.js +15 -16
  53. package/es/common/middleware/appSyncMiddleware.js +19 -0
  54. package/es/common/records/Quiz.js +8 -1
  55. package/es/common/records/QuizEntry.js +8 -1
  56. package/es/common/records/SessionItem.js +2 -1
  57. package/es/common/records/SessionItemResult.js +24 -0
  58. package/es/common/util/interactionTypePropsHelper.js +4 -2
  59. package/es/common/util/isMissing.js +4 -0
  60. package/es/configureStore.js +3 -1
  61. package/es/index.js +6 -4
  62. package/es/moderating/components/resources/ModerateTable/presenter.js +15 -10
  63. package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  64. package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  65. package/es/reduxStore.js +4 -0
  66. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
  67. package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
  68. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
  69. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
  70. package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
  71. package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
  72. package/es/taking/api/taking.js +45 -10
  73. package/lib/banks/components/BankEntry/presenter.js +1 -1
  74. package/lib/banks/components/SharingModal/presenter.js +1 -1
  75. package/lib/building/api/quizEntries.js +25 -5
  76. package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
  77. package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  78. package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
  79. package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  80. package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  81. package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  82. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  83. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  84. package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  85. package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  86. package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  87. package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  88. package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  89. package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  90. package/lib/common/actions/modal.js +2 -1
  91. package/lib/common/components/ApiFeatureFlagInitializer/index.js +1 -1
  92. package/lib/common/components/ConfirmationModal/index.js +1 -1
  93. package/lib/common/components/ConfirmationModal/presenter.js +49 -169
  94. package/lib/common/components/RceConfigProvider/presenter.js +1 -1
  95. package/lib/common/components/SDKApp/index.js +38 -39
  96. package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  97. package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
  98. package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  99. package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  100. package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  101. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  102. package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  103. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  104. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  105. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  106. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  107. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  108. package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
  109. package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
  110. package/lib/common/components/resources/item/ItemShow/index.js +2 -1
  111. package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  112. package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  113. package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  114. package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  115. package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  116. package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  117. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  118. package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  119. package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
  120. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  121. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  122. package/lib/common/components/shared/PaginatedCollection/presenter.js +1 -1
  123. package/lib/common/components/shared/PrintTrigger/presenter.js +1 -1
  124. package/lib/common/components/shared/spinner/Spinner.js +15 -16
  125. package/lib/common/middleware/appSyncMiddleware.js +19 -0
  126. package/lib/common/records/Quiz.js +8 -1
  127. package/lib/common/records/QuizEntry.js +8 -1
  128. package/lib/common/records/SessionItem.js +2 -1
  129. package/lib/common/records/SessionItemResult.js +24 -0
  130. package/lib/common/util/interactionTypePropsHelper.js +4 -2
  131. package/lib/common/util/isMissing.js +4 -0
  132. package/lib/configureStore.js +3 -1
  133. package/lib/index.js +6 -4
  134. package/lib/moderating/components/resources/ModerateTable/presenter.js +15 -10
  135. package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  136. package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  137. package/lib/reduxStore.js +4 -0
  138. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
  139. package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
  140. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
  141. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
  142. package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
  143. package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
  144. package/lib/taking/api/taking.js +45 -10
  145. package/package.json +10 -10
  146. package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  147. package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  148. package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
  149. package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  150. package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  151. package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  152. package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  153. package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
  154. package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  155. package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  156. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  157. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
  158. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  159. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
@@ -59,6 +59,45 @@ function _inherits(subClass, superClass) {
59
59
  });
60
60
  if (superClass) _set_prototype_of(subClass, superClass);
61
61
  }
62
+ function _object_spread(target) {
63
+ for(var i = 1; i < arguments.length; i++){
64
+ var source = arguments[i] != null ? arguments[i] : {};
65
+ var ownKeys = Object.keys(source);
66
+ if (typeof Object.getOwnPropertySymbols === "function") {
67
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
68
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
69
+ }));
70
+ }
71
+ ownKeys.forEach(function(key) {
72
+ _define_property(target, key, source[key]);
73
+ });
74
+ }
75
+ return target;
76
+ }
77
+ function ownKeys(object, enumerableOnly) {
78
+ var keys = Object.keys(object);
79
+ if (Object.getOwnPropertySymbols) {
80
+ var symbols = Object.getOwnPropertySymbols(object);
81
+ if (enumerableOnly) {
82
+ symbols = symbols.filter(function(sym) {
83
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
84
+ });
85
+ }
86
+ keys.push.apply(keys, symbols);
87
+ }
88
+ return keys;
89
+ }
90
+ function _object_spread_props(target, source) {
91
+ source = source != null ? source : {};
92
+ if (Object.getOwnPropertyDescriptors) {
93
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
94
+ } else {
95
+ ownKeys(Object(source)).forEach(function(key) {
96
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
97
+ });
98
+ }
99
+ return target;
100
+ }
62
101
  function _possible_constructor_return(self, call) {
63
102
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
64
103
  return call;
@@ -84,37 +123,43 @@ function _is_native_reflect_construct() {
84
123
  return !!result;
85
124
  })();
86
125
  }
87
- function _ts_decorate(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
126
  import { Component } from 'react';
94
127
  import PropTypes from 'prop-types';
95
128
  import ImmutablePropTypes from 'react-immutable-proptypes';
96
129
  import { Alert } from '@instructure/ui-alerts';
97
- import { Text } from '@instructure/ui-text';
98
130
  import { Heading } from '@instructure/ui-heading';
99
- import { View } from '@instructure/ui-view';
100
131
  import { PresentationContent } from '@instructure/ui-a11y-content';
101
132
  import { jsx } from '@instructure/emotion';
102
133
  import { RichContentRenderer } from '@instructure/quiz-rce';
103
134
  import t from '@instructure/quiz-i18n/format-message';
104
- import PositionBox from '../../positionBox/PositionBox';
105
135
  import { COMPONENT_RESULT, withStyleOverrides } from '@instructure/quiz-common';
106
136
  import componentForItem from '../../../../util/componentForItem';
107
137
  import CustomPropTypes from '../../../../util/CustomPropTypes';
108
138
  import keyboardClickable from '../../../../util/keyboardClickable';
139
+ import { SessionItemResultHeader } from './components/SessionItemResultHeader';
109
140
  import generateStyle from './styles';
110
141
  import generateComponentTheme from './theme';
111
- export var SessionItemResult = /*#__PURE__*/ function(Component) {
142
+ // Surveys don't have correct answers, so scoredData should be empty if no answer is given
143
+ // to avoid showing "incorrect" feedback
144
+ export var getAdjustedScoredData = function(originalScoredData, isSurvey, interactionTypeSlug) {
145
+ var hasNoAnswer = !(originalScoredData === null || originalScoredData === void 0 ? void 0 : originalScoredData.value);
146
+ var hasNoCorrectness = typeof (originalScoredData === null || originalScoredData === void 0 ? void 0 : originalScoredData.correct) === 'undefined';
147
+ if (isSurvey && hasNoAnswer && hasNoCorrectness) {
148
+ // File upload interactions expect an array for an empty value, others expect an object
149
+ var emptyValue = interactionTypeSlug === 'file-upload' ? [] : {};
150
+ return _object_spread_props(_object_spread({}, originalScoredData), {
151
+ value: emptyValue
152
+ });
153
+ }
154
+ return originalScoredData;
155
+ };
156
+ var SessionItemResultUnstyled = /*#__PURE__*/ function(Component) {
112
157
  "use strict";
113
- _inherits(SessionItemResult, Component);
114
- function SessionItemResult() {
115
- _class_call_check(this, SessionItemResult);
158
+ _inherits(SessionItemResultUnstyled, Component);
159
+ function SessionItemResultUnstyled() {
160
+ _class_call_check(this, SessionItemResultUnstyled);
116
161
  var _this;
117
- _this = _call_super(this, SessionItemResult, arguments), _define_property(_this, "getWorkingInstance", function(sessionItemResult) {
162
+ _this = _call_super(this, SessionItemResultUnstyled, arguments), _define_property(_this, "getWorkingInstance", function(sessionItemResult) {
118
163
  // Check for getWorkingInstance because it does not exist on results page object
119
164
  // and is only needed on the grading page
120
165
  if (sessionItemResult.getWorkingInstance) {
@@ -124,7 +169,7 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
124
169
  });
125
170
  return _this;
126
171
  }
127
- _create_class(SessionItemResult, [
172
+ _create_class(SessionItemResultUnstyled, [
128
173
  {
129
174
  key: "componentDidMount",
130
175
  value: function componentDidMount() {
@@ -137,80 +182,12 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
137
182
  this.props.makeStyles();
138
183
  }
139
184
  },
140
- {
141
- key: "points",
142
- get: function get() {
143
- var sessionItemResult = this.props.sessionItemResult;
144
- var normalizedSessionItemResult = sessionItemResult && sessionItemResult.toJS() || {};
145
- return normalizedSessionItemResult.score;
146
- }
147
- },
148
- {
149
- key: "pointsPresent",
150
- get: function get() {
151
- return typeof this.points === 'number';
152
- }
153
- },
154
- {
155
- key: "pointsPossible",
156
- get: function get() {
157
- return this.props.sessionItemResult.pointsPossible;
158
- }
159
- },
160
- {
161
- key: "pointsPossiblePresent",
162
- get: function get() {
163
- return typeof this.pointsPossible === 'number';
164
- }
165
- },
166
185
  {
167
186
  key: "questionNumber",
168
187
  value: function questionNumber() {
169
188
  return this.props.sessionItem.questionNumber;
170
189
  }
171
190
  },
172
- {
173
- key: "unscorable",
174
- value: function unscorable() {
175
- return this.props.sessionItemResult.scoredData.get('unscorable');
176
- }
177
- },
178
- {
179
- key: "regraded",
180
- value: function regraded() {
181
- return this.props.sessionItemResult.regradeInfo && this.props.sessionItemResult.regradeInfo.get('regraded');
182
- }
183
- },
184
- {
185
- key: "hasRegradeInfo",
186
- value: function hasRegradeInfo() {
187
- return this.props.sessionItemResult.regradeInfo && this.props.sessionItemResult.regradeInfo.size > 1;
188
- }
189
- },
190
- {
191
- key: "pointsDisplayText",
192
- get: function get() {
193
- var points = this.points;
194
- var possible = this.pointsPossible;
195
- if (this.pointsPresent && this.pointsPossiblePresent) {
196
- return t("{ possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
197
- points: points,
198
- possible: possible
199
- });
200
- }
201
- if (this.pointsPossiblePresent) {
202
- return t("{ possible, plural,\n one {# point}\n other {# points}\n } possible", {
203
- possible: possible
204
- });
205
- }
206
- if (this.pointsPresent) {
207
- return t("{ points, plural,\n one {# point}\n other {# points}\n } earned", {
208
- points: points
209
- });
210
- }
211
- return '';
212
- }
213
- },
214
191
  {
215
192
  key: "renderRegradeAlert",
216
193
  value: function renderRegradeAlert() {
@@ -231,80 +208,6 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
231
208
  }, /*#__PURE__*/ jsx(PresentationContent, null, message));
232
209
  }
233
210
  },
234
- {
235
- key: "renderRegradePoints",
236
- value: function renderRegradePoints() {
237
- return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(View, {
238
- as: "span",
239
- size: "small",
240
- margin: "small"
241
- }, /*#__PURE__*/ jsx(Text, {
242
- color: "secondary"
243
- }, t("Previous score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
244
- points: this.props.sessionItemResult.regradeInfo.get('originalScore') || 0,
245
- possible: this.props.sessionItemResult.regradeInfo.get('originalPointsPossible')
246
- }))), /*#__PURE__*/ jsx(View, {
247
- as: "span",
248
- size: "small",
249
- margin: "small"
250
- }, /*#__PURE__*/ jsx(Text, {
251
- color: "alert"
252
- }, t("Regrade score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
253
- points: this.props.sessionItemResult.regradeInfo.get('newScore') || 0,
254
- possible: this.props.sessionItemResult.regradeInfo.get('newPointsPossible')
255
- }))));
256
- }
257
- },
258
- {
259
- key: "renderHeader",
260
- value: function renderHeader() {
261
- return /*#__PURE__*/ jsx("div", {
262
- css: this.props.styles.sessionItemResultHeader
263
- }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
264
- }
265
- },
266
- {
267
- key: "renderResultQuestionNumber",
268
- value: function renderResultQuestionNumber() {
269
- var questionNumber = this.questionNumber();
270
- var questionNumberText;
271
- if (this.regraded() && this.unscorable()) {
272
- questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
273
- questionNumber: questionNumber
274
- });
275
- } else if (this.regraded()) {
276
- questionNumberText = t('Results for question {questionNumber, number}. This question has been regraded.', {
277
- questionNumber: questionNumber
278
- });
279
- } else if (this.unscorable() && this.props.editGraderFeedback) {
280
- questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question.', {
281
- questionNumber: questionNumber
282
- });
283
- } else if (this.unscorable()) {
284
- questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
285
- questionNumber: questionNumber
286
- });
287
- } else {
288
- questionNumberText = t('Results for question {questionNumber, number}.', {
289
- questionNumber: questionNumber
290
- });
291
- }
292
- return /*#__PURE__*/ jsx(PositionBox, {
293
- position: questionNumber,
294
- headingLevel: "h3",
295
- headingText: questionNumberText
296
- });
297
- }
298
- },
299
- {
300
- key: "renderPoints",
301
- value: function renderPoints() {
302
- return /*#__PURE__*/ jsx("div", {
303
- css: this.props.styles.points,
304
- className: "fs-mask"
305
- }, this.pointsDisplayText);
306
- }
307
- },
308
211
  {
309
212
  key: "renderFeedbackBox",
310
213
  value: function renderFeedbackBox(feedbackContent, formattedFeedbackTitle) {
@@ -382,6 +285,7 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
382
285
  var simpleResultsModifications = itemResultsModifications && itemResultsModifications.toJS() || {};
383
286
  var simpleSessionItem = sessionItem.toJS();
384
287
  var simpleSessionItemResult = sessionItemResult.toJS();
288
+ var finalScoredData = getAdjustedScoredData(simpleSessionItemResult.scoredData, this.props.isSurvey, slug);
385
289
  return /*#__PURE__*/ jsx("div", {
386
290
  css: this.props.styles.result
387
291
  }, /*#__PURE__*/ jsx("div", {
@@ -393,7 +297,7 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
393
297
  interactionData: simpleItem.interactionData,
394
298
  properties: simpleItem.properties || {},
395
299
  scoringData: simpleSessionItem.scoringData,
396
- scoredData: simpleSessionItemResult.scoredData,
300
+ scoredData: finalScoredData,
397
301
  itemResultsModifications: simpleResultsModifications[simpleSessionItem.id]
398
302
  })), this.renderItemFeedback(simpleSessionItemResult));
399
303
  }
@@ -401,17 +305,24 @@ export var SessionItemResult = /*#__PURE__*/ function(Component) {
401
305
  {
402
306
  key: "render",
403
307
  value: function render() {
308
+ var sessionItemResult = this.props.sessionItemResult;
404
309
  return /*#__PURE__*/ jsx("div", {
405
310
  css: this.props.styles.sessionItemResult
406
- }, this.regraded() ? this.renderRegradeAlert() : null, this.unscorable() ? this.renderUnscorableAlert() : null, this.renderHeader(), this.renderSessionItemResult());
311
+ }, sessionItemResult.isRegraded() ? this.renderRegradeAlert() : null, sessionItemResult.isUnscorable() ? this.renderUnscorableAlert() : null, /*#__PURE__*/ jsx(SessionItemResultHeader, {
312
+ sessionItemResult: this.props.sessionItemResult,
313
+ questionNumber: this.questionNumber(),
314
+ editGraderFeedback: this.props.editGraderFeedback,
315
+ restrictQuantitativeData: this.props.restrictQuantitativeData,
316
+ interactionTypeName: sessionItemResult.getItem().getInteractionType().name
317
+ }), this.renderSessionItemResult());
407
318
  }
408
319
  }
409
320
  ]);
410
- return SessionItemResult;
321
+ return SessionItemResultUnstyled;
411
322
  }(Component);
412
- _define_property(SessionItemResult, "displayName", 'SessionItemResult');
413
- _define_property(SessionItemResult, "componentId", "Quizzes".concat(SessionItemResult.displayName));
414
- _define_property(SessionItemResult, "propTypes", {
323
+ _define_property(SessionItemResultUnstyled, "displayName", 'SessionItemResult');
324
+ _define_property(SessionItemResultUnstyled, "componentId", "Quizzes".concat(SessionItemResultUnstyled.displayName));
325
+ _define_property(SessionItemResultUnstyled, "propTypes", {
415
326
  appContainer: CustomPropTypes.selectors.isRequired,
416
327
  editGraderFeedback: PropTypes.func,
417
328
  hideGraderFeedback: PropTypes.bool,
@@ -419,20 +330,21 @@ _define_property(SessionItemResult, "propTypes", {
419
330
  restrictQuantitativeData: PropTypes.bool,
420
331
  sessionItem: ImmutablePropTypes.record.isRequired,
421
332
  sessionItemResult: ImmutablePropTypes.record.isRequired,
333
+ interactionType: PropTypes.object.isRequired,
422
334
  shouldRenderAnswerFeedback: PropTypes.bool,
423
335
  shouldRenderTopBorder: PropTypes.bool,
336
+ isSurvey: PropTypes.bool,
424
337
  styles: PropTypes.object,
425
338
  makeStyles: PropTypes.func
426
339
  });
427
- _define_property(SessionItemResult, "defaultProps", {
340
+ _define_property(SessionItemResultUnstyled, "defaultProps", {
428
341
  editGraderFeedback: null,
429
342
  hideGraderFeedback: false,
430
343
  itemResultsModifications: null,
431
344
  restrictQuantitativeData: false,
432
345
  shouldRenderAnswerFeedback: false,
433
- shouldRenderTopBorder: true
346
+ shouldRenderTopBorder: true,
347
+ isSurvey: false
434
348
  });
435
- SessionItemResult = _ts_decorate([
436
- withStyleOverrides(generateStyle, generateComponentTheme)
437
- ], SessionItemResult);
349
+ export var SessionItemResult = withStyleOverrides(generateStyle, generateComponentTheme)(SessionItemResultUnstyled);
438
350
  export default SessionItemResult;
@@ -36,17 +36,9 @@ var generateStyle = function(componentTheme, props) {
36
36
  result: {
37
37
  margin: componentTheme.resultMargin
38
38
  },
39
- points: {
40
- color: componentTheme.pointsColor,
41
- fontSize: componentTheme.pointFontSize
42
- },
43
39
  question: {
44
40
  fontSize: componentTheme.questionFontSize
45
41
  },
46
- sessionItemResultHeader: {
47
- display: 'flex',
48
- alignItems: 'center'
49
- },
50
42
  itemFeedbackWrapper: {
51
43
  marginTop: componentTheme.itemFeedbackWrapperMargin,
52
44
  padding: componentTheme.itemFeedbackWrapperPadding,
@@ -3,6 +3,7 @@ import { connect } from '../../../../react-redux';
3
3
  import { openDeleteStimulusModal } from '../../../../actions/modal';
4
4
  import { set } from '../../../../actions/ui';
5
5
  import { featureOn } from '../../../../../common/util/featureCheck';
6
+ import { getActiveQuiz } from '../../../../../common/selectors/quizzes';
6
7
  import WrappedStimulus from './presenter';
7
8
  var mapStateToProps = function(state, props) {
8
9
  var dndPosition = state.getIn([
@@ -18,13 +19,15 @@ var mapStateToProps = function(state, props) {
18
19
  'intoEmptyStimulus'
19
20
  ]);
20
21
  var draggingOver = props.draggingOnBuild && dndPosition === props.quizEntry.position;
22
+ var activeQuiz = getActiveQuiz(state);
21
23
  return {
22
24
  childEntries: props.quizEntry.getNestedEntries(),
23
25
  dropIntoEmptyStimulus: draggingOver && dropIntoEmptyStimulus,
24
26
  draggingOver: draggingOver,
25
27
  draggingAboveHalf: draggingOver && draggingAboveHalf,
26
28
  lockBlueprintContentEnabled: featureOn('lock_blueprint_content'),
27
- stimulusOrientationEnabled: featureOn('customizable_stimulus_orientation')
29
+ stimulusOrientationEnabled: featureOn('customizable_stimulus_orientation'),
30
+ isSurvey: activeQuiz.isSurvey()
28
31
  };
29
32
  };
30
33
  var mapDispatchToProps = function(dispatch) {
@@ -233,6 +233,7 @@ export var Stimulus = /*#__PURE__*/ function(Component) {
233
233
  displayPosition: this.props.displayPosition,
234
234
  guid: this.props.guid,
235
235
  isBankedContent: this.props.isBankedContent,
236
+ isSurvey: this.props.isSurvey,
236
237
  openDeleteStimulusModal: this.openDeleteStimulusModal,
237
238
  quizEntries: this.props.quizEntries,
238
239
  quizEntry: this.props.quizEntry,
@@ -310,6 +311,7 @@ _define_property(Stimulus, "propTypes", {
310
311
  isBankedContent: PropTypes.bool,
311
312
  isContentLockedByBlueprint: PropTypes.bool.isRequired,
312
313
  isEditing: PropTypes.bool,
314
+ isSurvey: PropTypes.bool.isRequired,
313
315
  guid: PropTypes.string.isRequired,
314
316
  lockBlueprintContentEnabled: PropTypes.bool.isRequired,
315
317
  openDeleteStimulusModal: PropTypes.func.isRequired,
@@ -605,7 +605,7 @@ export var StimulusEdit = /*#__PURE__*/ function(Component) {
605
605
  stimulus: this.props.stimulus,
606
606
  isBankedContent: this.props.isBankedContent,
607
607
  setTitleRef: this.setTitleRef
608
- }), this.renderAddToBankOptions())), /*#__PURE__*/ jsx("div", {
608
+ }), !this.props.isSurvey && this.renderAddToBankOptions())), /*#__PURE__*/ jsx("div", {
609
609
  className: "footer",
610
610
  css: this.props.styles.footer
611
611
  }, /*#__PURE__*/ jsx("div", {
@@ -666,6 +666,7 @@ _define_property(StimulusEdit, "propTypes", {
666
666
  guid: PropTypes.string.isRequired,
667
667
  hideError: PropTypes.func.isRequired,
668
668
  isBankedContent: PropTypes.bool,
669
+ isSurvey: PropTypes.bool,
669
670
  openModal: PropTypes.func.isRequired,
670
671
  openDeleteStimulusModal: PropTypes.func.isRequired,
671
672
  nextQuizEntry: ImmutablePropTypes.map,
@@ -693,6 +694,7 @@ _define_property(StimulusEdit, "defaultProps", {
693
694
  bankEntryWarningWrapperProps: function() {},
694
695
  errorsShowing: false,
695
696
  isBankedContent: false,
697
+ isSurvey: false,
696
698
  nextQuizEntry: null
697
699
  });
698
700
  StimulusEdit = _ts_decorate([
@@ -216,7 +216,7 @@ import PropTypes from 'prop-types';
216
216
  import ImmutablePropTypes from 'react-immutable-proptypes';
217
217
  import { jsx } from '@instructure/emotion';
218
218
  import Paginator from '../Paginator';
219
- import Spinner from '../spinner/Spinner';
219
+ import { Spinner } from '../spinner/Spinner';
220
220
  /**
221
221
  * Renders pagination controls and manages state of page contents. `getPage`
222
222
  * will be called with the page number and any collection parameters, and should
@@ -113,7 +113,7 @@ import React, { Component } from 'react';
113
113
  import PropTypes from 'prop-types';
114
114
  import { Overlay, Mask } from '@instructure/ui-overlays';
115
115
  import t from '@instructure/quiz-i18n/format-message';
116
- import { QuizzesSpinner as Spinner } from '../spinner/Spinner';
116
+ import { Spinner } from '../spinner/Spinner';
117
117
  import CustomPropTypes from '../../../util/CustomPropTypes';
118
118
  import { printWithCss, ensureImagesLoaded } from '../../../util/printUtils';
119
119
  import PrintFontSizeModal from '../../PrintFontSizeModal';
@@ -93,19 +93,19 @@ function _ts_decorate(decorators, target, key, desc) {
93
93
  import { Component } from 'react';
94
94
  import PropTypes from 'prop-types';
95
95
  import { Text } from '@instructure/ui-text';
96
- import { Spinner } from '@instructure/ui-spinner';
96
+ import { Spinner as InstUISpinner } from '@instructure/ui-spinner';
97
97
  import { PresentationContent } from '@instructure/ui-a11y-content';
98
98
  import { jsx } from '@instructure/emotion';
99
99
  import t from '@instructure/quiz-i18n/format-message';
100
100
  import generateStyle from './styles';
101
101
  import { withStyleOverrides } from '@instructure/quiz-common';
102
- export var QuizzesSpinner = /*#__PURE__*/ function(Component) {
102
+ export var Spinner = /*#__PURE__*/ function(Component) {
103
103
  "use strict";
104
- _inherits(QuizzesSpinner, Component);
105
- function QuizzesSpinner(props) {
106
- _class_call_check(this, QuizzesSpinner);
104
+ _inherits(Spinner, Component);
105
+ function Spinner(props) {
106
+ _class_call_check(this, Spinner);
107
107
  var _this;
108
- _this = _call_super(this, QuizzesSpinner, [
108
+ _this = _call_super(this, Spinner, [
109
109
  props
110
110
  ]);
111
111
  _this.state = {
@@ -113,7 +113,7 @@ export var QuizzesSpinner = /*#__PURE__*/ function(Component) {
113
113
  };
114
114
  return _this;
115
115
  }
116
- _create_class(QuizzesSpinner, [
116
+ _create_class(Spinner, [
117
117
  {
118
118
  key: "componentDidMount",
119
119
  value: function componentDidMount() {
@@ -156,18 +156,18 @@ export var QuizzesSpinner = /*#__PURE__*/ function(Component) {
156
156
  style: {
157
157
  minHeight: minHeight
158
158
  }
159
- }, /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(Spinner, {
159
+ }, /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(InstUISpinner, {
160
160
  renderTitle: this.mainText(),
161
161
  size: size
162
162
  })), /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(PresentationContent, null, this.mainText())));
163
163
  }
164
164
  }
165
165
  ]);
166
- return QuizzesSpinner;
166
+ return Spinner;
167
167
  }(Component);
168
- _define_property(QuizzesSpinner, "displayName", 'QuizzesSpinner');
169
- _define_property(QuizzesSpinner, "componentId", "Quizzes".concat(QuizzesSpinner.displayName));
170
- _define_property(QuizzesSpinner, "propTypes", {
168
+ _define_property(Spinner, "displayName", 'QuizzesSpinner');
169
+ _define_property(Spinner, "componentId", "Quizzes".concat(Spinner.displayName));
170
+ _define_property(Spinner, "propTypes", {
171
171
  mainText: PropTypes.string,
172
172
  fontSize: PropTypes.oneOf([
173
173
  'x-small',
@@ -188,14 +188,13 @@ _define_property(QuizzesSpinner, "propTypes", {
188
188
  styles: PropTypes.object,
189
189
  delay: PropTypes.number
190
190
  });
191
- _define_property(QuizzesSpinner, "defaultProps", {
191
+ _define_property(Spinner, "defaultProps", {
192
192
  mainText: null,
193
193
  size: 'large',
194
194
  fontSize: 'xx-large',
195
195
  minHeight: '500px',
196
196
  color: 'primary'
197
197
  });
198
- QuizzesSpinner = _ts_decorate([
198
+ Spinner = _ts_decorate([
199
199
  withStyleOverrides(generateStyle, null)
200
- ], QuizzesSpinner);
201
- export default QuizzesSpinner;
200
+ ], Spinner);
@@ -0,0 +1,19 @@
1
+ import { appDispatch } from '../../reduxStore';
2
+ export function createAppSyncMiddleware() {
3
+ return function(store) {
4
+ return function(next) {
5
+ return function(action) {
6
+ if (!appDispatch) {
7
+ return next(action);
8
+ }
9
+ if (action.type === 'ADD_QUIZZES') {
10
+ appDispatch({
11
+ type: 'APPSYNC_ADD_QUIZZES',
12
+ payload: action.payload
13
+ });
14
+ }
15
+ return next(action);
16
+ };
17
+ };
18
+ };
19
+ }
@@ -219,6 +219,12 @@ export var Quiz = /*#__PURE__*/ function(_ReduxRecord) {
219
219
  return this.oneAtATimeType === 'question';
220
220
  }
221
221
  },
222
+ {
223
+ key: "isSurvey",
224
+ value: function isSurvey() {
225
+ return this.quizType === 'ungraded_survey' || this.quizType === 'graded_survey';
226
+ }
227
+ },
222
228
  {
223
229
  key: "state",
224
230
  value: function state() {
@@ -272,7 +278,8 @@ export var Quiz = /*#__PURE__*/ function(_ReduxRecord) {
272
278
  title: t('Add Title...'),
273
279
  filterIpAddress: false,
274
280
  filters: Map(),
275
- valid: true
281
+ valid: true,
282
+ quizType: null
276
283
  }));
277
284
  _ts_decorate([
278
285
  withStateCache(function(quiz) {
@@ -335,7 +335,8 @@ export var QuizEntry = /*#__PURE__*/ function(_ReduxRecord) {
335
335
  return {
336
336
  points_possible: this.pointsPossible && parseFloat(this.pointsPossible),
337
337
  position: this.position && Math.ceil(this.position),
338
- stimulus_quiz_entry_id: this.stimulusQuizEntryId
338
+ stimulus_quiz_entry_id: this.stimulusQuizEntryId,
339
+ required: Boolean(this.isRequired)
339
340
  };
340
341
  }
341
342
  },
@@ -502,6 +503,12 @@ export var QuizEntry = /*#__PURE__*/ function(_ReduxRecord) {
502
503
  return parseInt(this.properties.get('sampleNum'), 10);
503
504
  }
504
505
  },
506
+ {
507
+ key: "isRequired",
508
+ get: function get() {
509
+ return Boolean(this.properties.get('required'), false);
510
+ }
511
+ },
505
512
  {
506
513
  key: "selection",
507
514
  get: function get() {
@@ -212,6 +212,7 @@ export var SessionItem = /*#__PURE__*/ function(_ReduxRecord) {
212
212
  calculatorType: 'none',
213
213
  stimulus: null,
214
214
  stimulusKey: null,
215
- bolaPosition: null
215
+ bolaPosition: null,
216
+ required: false
216
217
  }));
217
218
  export default SessionItem;
@@ -128,6 +128,30 @@ export var SessionItemResult = /*#__PURE__*/ function(_ReduxRecord) {
128
128
  value: function isGraded() {
129
129
  return !!this.gradedAt;
130
130
  }
131
+ },
132
+ {
133
+ key: "hasRegradeInfo",
134
+ value: function hasRegradeInfo() {
135
+ return this.regradeInfo && this.regradeInfo.size > 1;
136
+ }
137
+ },
138
+ {
139
+ key: "isUnscorable",
140
+ value: function isUnscorable() {
141
+ return this.scoredData.get('unscorable');
142
+ }
143
+ },
144
+ {
145
+ key: "isRegraded",
146
+ value: function isRegraded() {
147
+ return this.regradeInfo && this.regradeInfo.get('regraded');
148
+ }
149
+ },
150
+ {
151
+ key: "interactionType",
152
+ value: function interactionType() {
153
+ return this.interactionType || null;
154
+ }
131
155
  }
132
156
  ]);
133
157
  return SessionItemResult;
@@ -62,7 +62,8 @@ export var propsForInteractionEdit = function(props, additionalOptions) {
62
62
  calculatorType: item.calculatorType,
63
63
  multipleHotSpotEnabled: featureOn('multiple_hotspot_selections'),
64
64
  showCalculatorOption: props.showCalculatorOption,
65
- separatorConfig: props.separatorConfig
65
+ separatorConfig: props.separatorConfig,
66
+ isSurvey: props.isSurvey
66
67
  };
67
68
  };
68
69
  export var propsForInteractionShow = function(item) {
@@ -77,6 +78,7 @@ export var propsForInteractionShow = function(item) {
77
78
  properties: item.properties,
78
79
  notifyScreenreader: true,
79
80
  scoringData: item.scoringData,
80
- separatorConfig: props.separatorConfig
81
+ separatorConfig: props.separatorConfig,
82
+ isSurvey: props.isSurvey
81
83
  };
82
84
  };
@@ -0,0 +1,4 @@
1
+ export var isMissing = function(value) {
2
+ return typeof value === 'number' === false;
3
+ };
4
+ export var UNKNOWN_PERCENTAGE_VALUE = 'UNKNOWN_PERCENTAGE';