@instructure/quiz-core 22.16.1 → 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 (133) hide show
  1. package/es/building/api/quizEntries.js +25 -5
  2. package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
  3. package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  4. package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
  5. package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  6. package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  7. package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  8. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  9. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  10. package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  11. package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  12. package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  13. package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  14. package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  15. package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  16. package/es/common/actions/modal.js +2 -1
  17. package/es/common/components/ConfirmationModal/index.js +1 -1
  18. package/es/common/components/ConfirmationModal/presenter.js +49 -169
  19. package/es/common/components/SDKApp/index.js +22 -23
  20. package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  21. package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
  22. package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  23. package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  24. package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  25. package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  26. package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  27. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  28. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  29. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  30. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  31. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  32. package/es/common/components/resources/item/ItemEdit/index.js +5 -3
  33. package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
  34. package/es/common/components/resources/item/ItemShow/index.js +2 -1
  35. package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  36. package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  37. package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  38. package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  39. package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  40. package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  41. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  42. package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  43. package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
  44. package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  45. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  46. package/es/common/middleware/appSyncMiddleware.js +19 -0
  47. package/es/common/records/Quiz.js +8 -1
  48. package/es/common/records/QuizEntry.js +8 -1
  49. package/es/common/records/SessionItem.js +2 -1
  50. package/es/common/records/SessionItemResult.js +24 -0
  51. package/es/common/util/interactionTypePropsHelper.js +4 -2
  52. package/es/common/util/isMissing.js +4 -0
  53. package/es/configureStore.js +3 -1
  54. package/es/index.js +4 -2
  55. package/es/moderating/components/resources/ModerateTable/presenter.js +14 -9
  56. package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  57. package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  58. package/es/reduxStore.js +4 -0
  59. package/es/taking/api/taking.js +45 -10
  60. package/lib/building/api/quizEntries.js +25 -5
  61. package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
  62. package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  63. package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
  64. package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  65. package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  66. package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  67. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  68. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  69. package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  70. package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  71. package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  72. package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  73. package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  74. package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  75. package/lib/common/actions/modal.js +2 -1
  76. package/lib/common/components/ConfirmationModal/index.js +1 -1
  77. package/lib/common/components/ConfirmationModal/presenter.js +49 -169
  78. package/lib/common/components/SDKApp/index.js +22 -23
  79. package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  80. package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
  81. package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  82. package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  83. package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  84. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  85. package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  86. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  87. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  88. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  89. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  90. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  91. package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
  92. package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
  93. package/lib/common/components/resources/item/ItemShow/index.js +2 -1
  94. package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  95. package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  96. package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  97. package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  98. package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  99. package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  100. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  101. package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  102. package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
  103. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  104. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  105. package/lib/common/middleware/appSyncMiddleware.js +19 -0
  106. package/lib/common/records/Quiz.js +8 -1
  107. package/lib/common/records/QuizEntry.js +8 -1
  108. package/lib/common/records/SessionItem.js +2 -1
  109. package/lib/common/records/SessionItemResult.js +24 -0
  110. package/lib/common/util/interactionTypePropsHelper.js +4 -2
  111. package/lib/common/util/isMissing.js +4 -0
  112. package/lib/configureStore.js +3 -1
  113. package/lib/index.js +4 -2
  114. package/lib/moderating/components/resources/ModerateTable/presenter.js +14 -9
  115. package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  116. package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  117. package/lib/reduxStore.js +4 -0
  118. package/lib/taking/api/taking.js +45 -10
  119. package/package.json +10 -10
  120. package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  121. package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  122. package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
  123. package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  124. package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  125. package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  126. package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  127. package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
  128. package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  129. package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  130. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  131. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
  132. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  133. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
@@ -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
- function mapStateToProps(state) {
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);
@@ -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([
@@ -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;