diff --git a/src/components/Assignments/Assignment/AssignmentTableRow/AssignmentTableRow.js b/src/components/Assignments/Assignment/AssignmentTableRow/AssignmentTableRow.js
index fc6dd2c2e..dc08ce878 100644
--- a/src/components/Assignments/Assignment/AssignmentTableRow/AssignmentTableRow.js
+++ b/src/components/Assignments/Assignment/AssignmentTableRow/AssignmentTableRow.js
@@ -54,7 +54,7 @@ const AssignmentTableRow = ({
{data =>
- data.lastSubmission
+ data && data.lastSubmission
?
{data.lastSubmission.evaluation.points}
{data.bonusPoints > 0 &&
diff --git a/src/pages/Group/Group.js b/src/pages/Group/Group.js
index a1022c291..95c570a5b 100644
--- a/src/pages/Group/Group.js
+++ b/src/pages/Group/Group.js
@@ -110,9 +110,13 @@ class Group extends Component {
}
componentWillReceiveProps(newProps) {
- const { params: { groupId } } = this.props;
+ const { params: { groupId }, userId, isSuperAdmin } = this.props;
- if (groupId !== newProps.params.groupId) {
+ if (
+ groupId !== newProps.params.groupId ||
+ userId !== newProps.userId ||
+ isSuperAdmin !== newProps.isSuperAdmin
+ ) {
newProps.loadAsync(newProps.userId, newProps.isSuperAdmin);
return;
}
diff --git a/src/redux/modules/groupResults.js b/src/redux/modules/groupResults.js
index 73756bdbd..1f2859abc 100644
--- a/src/redux/modules/groupResults.js
+++ b/src/redux/modules/groupResults.js
@@ -48,18 +48,37 @@ const reducer = handleActions(
[additionalActionTypes.BEST_SUBMISSION_PENDING]: (
state,
{ payload, meta: { userId, assignmentId } }
- ) => state.setIn(['resources', assignmentId, userId], createRecord()),
+ ) =>
+ userId !== undefined
+ ? state.setIn(['resources', assignmentId, userId], createRecord())
+ : state,
[additionalActionTypes.BEST_SUBMISSION_FULFILLED]: (
state,
{ payload = {}, meta: { assignmentId, userId } }
- ) =>
- state
- .setIn(['resources', assignmentId, userId, 'data'], fromJS(payload))
- .setIn(
- ['resources', assignmentId, userId, 'state'],
- resourceStatus.FULFILLED
- )
+ ) => {
+ if (userId !== undefined) {
+ // update single-user record
+ return state
+ .setIn(['resources', assignmentId, userId, 'data'], fromJS(payload))
+ .setIn(
+ ['resources', assignmentId, userId, 'state'],
+ resourceStatus.FULFILLED
+ );
+ } else {
+ // Update for each user in the payload
+ for (const uId in payload) {
+ state = state.setIn(
+ ['resources', assignmentId, uId],
+ createRecord({
+ data: fromJS(payload[uId]),
+ state: resourceStatus.FULFILLED
+ })
+ );
+ }
+ return state;
+ }
+ }
}),
initialState
);
|