Coursemology/coursemology2

View on GitHub
client/app/bundles/course/assessment/submission/reducers/history/questions.js

Summary

Maintainability
B
5 hrs
Test Coverage

Function default has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (state = {}, action) {
  switch (action.type) {
    case actions.FETCH_SUBMISSION_SUCCESS: {
      if (action.payload.history) {
        return {

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [questionId]: {
          ...state[questionId],
          answerIds,

Avoid too many return statements within this function.
Open

        return produce(state, (draft) => {
          const question = draft[questionId];
          const answerIds = question.answerIds;
          // Ensure that the id is not being repeatedly added
          if (answerIds.indexOf(latestAnswer.id) === -1) {

Avoid too many return statements within this function.
Open

      return state;

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [questionId]: {
          ...state[questionId],
          isLoading: false,

There are no issues that match your filters.

Category
Status