import LargeCheck from '../common/LargeCheck';
import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik';
-import { findResult } from '../../helpers/Participant';
+import { findResult } from '../../helpers/User';
import { formatTime, parseTime } from '../../helpers/Result';
import i18n from '../../i18n';
import yup from '../../schema/yup';
displayName: 'ReportForm',
enableReinitialize: true,
handleSubmit: async (values, actions) => {
- const { comment, forfeit, participant_id, round_id, time } = values;
+ const { comment, forfeit, round_id, time, user_id } = values;
const { setErrors } = actions;
const { onCancel } = actions.props;
try {
await axios.post('/api/results', {
comment,
forfeit,
- participant_id,
round_id,
time: parseTime(time) || 0,
+ user_id,
});
toastr.success(i18n.t('results.reportSuccess'));
if (onCancel) {
}
}
},
- mapPropsToValues: ({ participant, round }) => {
- const result = findResult(participant, round);
+ mapPropsToValues: ({ round, user }) => {
+ const result = findResult(user, round);
return {
comment: result && result.comment ? result.comment : '',
forfeit: result ? !!result.forfeit : false,
- participant_id: participant.id,
round_id: round.id,
time: result && result.time ? formatTime(result) : '',
+ user_id: user.id,
};
},
validationSchema: yup.object().shape({