Skip to content
Snippets Groups Projects
Commit 2aa542cd authored by Bereczki Sandor's avatar Bereczki Sandor
Browse files

Solution without File fixed

You can now send solution without a file, the admin will see a 'No file' tag.
parent c959d6a8
No related branches found
No related tags found
No related merge requests found
...@@ -151,7 +151,6 @@ export const addSolution = ({ ...@@ -151,7 +151,6 @@ export const addSolution = ({
note, note,
}); });
if (response.data.id) { if (response.data.id) {
console.log(response.data.id);
dispatch({ dispatch({
type: ADD_SOLUTION, type: ADD_SOLUTION,
payload: response.data, payload: response.data,
...@@ -159,7 +158,6 @@ export const addSolution = ({ ...@@ -159,7 +158,6 @@ export const addSolution = ({
} }
const solution = response.data.id; const solution = response.data.id;
console.log(solution);
const formData = new FormData(); const formData = new FormData();
formData.append('name', name); formData.append('name', name);
......
...@@ -23,10 +23,14 @@ class CorrectSolutionForm extends Component { ...@@ -23,10 +23,14 @@ class CorrectSolutionForm extends Component {
document.uploaded_by_name === studentFullName); document.uploaded_by_name === studentFullName);
const relevantDocument = relevantDocuments[relevantDocuments.length - 1]; const relevantDocument = relevantDocuments[relevantDocuments.length - 1];
let fileLink; let fileLink;
if (relevantDocument !== undefined || relevantDocument !== null) { if (relevantDocument !== undefined && relevantDocument !== null &&
relevantDocument.file !== undefined && relevantDocument.file !== null) {
fileLink = `/media${relevantDocument.file.split('media')[1]}`; fileLink = `/media${relevantDocument.file.split('media')[1]}`;
} else {
fileLink = null;
} }
const { note } = this.props.correction; const { note } = this.props.correction;
return ( return (
<Modal <Modal
...@@ -47,9 +51,9 @@ class CorrectSolutionForm extends Component { ...@@ -47,9 +51,9 @@ class CorrectSolutionForm extends Component {
</Modal.Header> </Modal.Header>
<Modal.Content> <Modal.Content>
<Header as='h5'>A megoldás leírása:</Header> <Header as='h5'>A megoldás leírása:</Header>
{relevantDocument === undefined ? 'Nincs leírás.' : relevantDocument.description.split('\n')} {fileLink === null ? 'Nincs leírás.' : relevantDocument.description.split('\n')}
<Header as='h5'>A beadott dokumentum:</Header> <Header as='h5'>A beadott dokumentum:</Header>
{relevantDocument === undefined ? {fileLink === null ?
<p>Nincs fájl.</p> : <p>Nincs fájl.</p> :
<a href={fileLink}>Fájl letöltése</a>} <a href={fileLink}>Fájl letöltése</a>}
<Header as='h5'>Elfogadás/Elutasítás:</Header> <Header as='h5'>Elfogadás/Elutasítás:</Header>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment