From f8b83054a10deeaba16eeec8ae72dc986ebd7e86 Mon Sep 17 00:00:00 2001 From: Bereczki Sandor <bsandor453@gmail.com> Date: Mon, 18 Feb 2019 16:55:17 +0100 Subject: [PATCH] Fixed an issue with solution retrieving Fixed the bug when the admin browses the solutions and the student uploads a solution during this, the admin did not see the new solution. Now works correctly. --- src/components/forms/SolutionDetailsForm.js | 12 +++++++++++- src/components/pages/Homework.js | 7 +++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/forms/SolutionDetailsForm.js b/src/components/forms/SolutionDetailsForm.js index ea47851..f702c51 100644 --- a/src/components/forms/SolutionDetailsForm.js +++ b/src/components/forms/SolutionDetailsForm.js @@ -4,6 +4,9 @@ import { connect } from 'react-redux'; import CorrectSolutionForm from './CorrectSolutionForm'; import { emptyMessage } from '../pages/Homework'; import './Forms.css'; +import { + getSolutions, +} from '../../actions/homework'; class SolutionDetailsForm extends Component { constructor(props) { @@ -45,7 +48,13 @@ class SolutionDetailsForm extends Component { <Modal open={this.state.showModal} trigger={ - <button id='task' onClick={() => { this.setState({ showModal: true }); }}> + <button + id='task' + onClick={() => { + this.setState({ showModal: true }); + this.props.getSolutions(); + }} + > <Icon name='external' /> {this.props.tasktitle} </button> @@ -115,4 +124,5 @@ class SolutionDetailsForm extends Component { const mapStateToProps = ({ homeworks, user }) => ({ homeworks, user }); export default connect(mapStateToProps, { + getSolutions, })(SolutionDetailsForm); diff --git a/src/components/pages/Homework.js b/src/components/pages/Homework.js index 12f8fac..8bbf47c 100644 --- a/src/components/pages/Homework.js +++ b/src/components/pages/Homework.js @@ -68,7 +68,6 @@ export const emptyMessage = (header, text, marginBottom, warning) => ( class Homework extends Component { componentDidMount() { this.props.getTasks(); - this.props.getSolutions(this.props.user.id); this.props.getProfiles(); this.props.getDocuments(); } @@ -161,7 +160,11 @@ class Homework extends Component { } > <Table.Cell> - <SolutionDetailsForm taskid={task.id} tasktitle={task.title} taskdesc={task.text} /> + <SolutionDetailsForm + taskid={task.id} + tasktitle={task.title} + taskdesc={task.text} + /> </Table.Cell> <Table.Cell> {moment(task.deadline).format('YYYY. MM. DD. HH:mm')} -- GitLab