Skip to content

Commit

Permalink
fix: backend projects not submitting (#38900)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
  • Loading branch information
moT01 and ojeytonwilliams committed May 26, 2020
1 parent aef89d2 commit a001041
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
7 changes: 2 additions & 5 deletions client/src/templates/Challenges/projects/backend/Show.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
consoleOutputSelector,
initConsole,
initTests,
updateBackendFormValues,
updateChallengeMeta,
updateSolutionFormValues
} from '../../redux';
Expand Down Expand Up @@ -53,7 +52,6 @@ const propTypes = {
}),
tests: PropTypes.array,
title: PropTypes.string,
updateBackendFormValues: PropTypes.func.isRequired,
updateChallengeMeta: PropTypes.func.isRequired,
updateSolutionFormValues: PropTypes.func.isRequired
};
Expand All @@ -74,7 +72,6 @@ const mapDispatchToActions = {
executeChallenge,
initConsole,
initTests,
updateBackendFormValues,
updateChallengeMeta,
updateSolutionFormValues
};
Expand Down Expand Up @@ -155,7 +152,7 @@ export class BackEnd extends Component {
},
tests,
executeChallenge,
updateBackendFormValues
updateSolutionFormValues
} = this.props;

const blockNameTitle = `${blockName} - ${title}`;
Expand All @@ -181,7 +178,7 @@ export class BackEnd extends Component {
<SolutionForm
challengeType={challengeType}
onSubmit={executeChallenge}
updateSolutionForm={updateBackendFormValues}
updateSolutionForm={updateSolutionFormValues}
/>
<ProjectToolPanel
guideUrl={getGuideUrl({ forumTopicId, title })}
Expand Down
3 changes: 1 addition & 2 deletions client/src/templates/Challenges/redux/completion-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ofType } from 'redux-observable';
import { navigate } from 'gatsby';

import {
backendFormValuesSelector,
projectFormValuesSelector,
types,
challengeMetaSelector,
Expand Down Expand Up @@ -108,7 +107,7 @@ function submitBackendChallenge(type, state) {
const { username } = userSelector(state);
const {
solution: { value: solution }
} = backendFormValuesSelector(state);
} = projectFormValuesSelector(state);
const challengeInfo = { id, solution };

const update = {
Expand Down
12 changes: 1 addition & 11 deletions client/src/templates/Challenges/redux/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const types = createTypes(
'initTests',
'initConsole',
'initLogs',
'updateBackendFormValues',
'updateConsole',
'updateChallengeMeta',
'updateFile',
Expand Down Expand Up @@ -128,9 +127,6 @@ export const cancelTests = createAction(types.cancelTests);

export const initConsole = createAction(types.initConsole);
export const initLogs = createAction(types.initLogs);
export const updateBackendFormValues = createAction(
types.updateBackendFormValues
);
export const updateChallengeMeta = createAction(types.updateChallengeMeta);
export const updateFile = createAction(types.updateFile);
export const updateConsole = createAction(types.updateConsole);
Expand Down Expand Up @@ -190,8 +186,6 @@ export const isResetModalOpenSelector = state => state[ns].modal.reset;
export const isBuildEnabledSelector = state => state[ns].isBuildEnabled;
export const successMessageSelector = state => state[ns].successMessage;

export const backendFormValuesSelector = state =>
state[ns].backendFormValues || {};
export const projectFormValuesSelector = state =>
state[ns].projectFormValues || {};

Expand All @@ -207,7 +201,7 @@ export const challengeDataSelector = state => {
files: challengeFilesSelector(state)
};
} else if (challengeType === challengeTypes.backend) {
const { solution: url = {} } = backendFormValuesSelector(state);
const { solution: url = {} } = projectFormValuesSelector(state);
challengeData = {
...challengeData,
url
Expand Down Expand Up @@ -329,10 +323,6 @@ export const reducer = handleActions(
})),
consoleOut: ''
}),
[types.updateBackendFormValues]: (state, { payload }) => ({
...state,
backendFormValues: payload
}),
[types.updateSolutionFormValues]: (state, { payload }) => ({
...state,
projectFormValues: payload
Expand Down

0 comments on commit a001041

Please sign in to comment.