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 = ({
note,
});
if (response.data.id) {
console.log(response.data.id);
dispatch({
type: ADD_SOLUTION,
payload: response.data,
......@@ -159,7 +158,6 @@ export const addSolution = ({
}
const solution = response.data.id;
console.log(solution);
const formData = new FormData();
formData.append('name', name);
......
......@@ -23,10 +23,14 @@ class CorrectSolutionForm extends Component {
document.uploaded_by_name === studentFullName);
const relevantDocument = relevantDocuments[relevantDocuments.length - 1];
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]}`;
} else {
fileLink = null;
}
const { note } = this.props.correction;
return (
<Modal
......@@ -47,9 +51,9 @@ class CorrectSolutionForm extends Component {
</Modal.Header>
<Modal.Content>
<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>
{relevantDocument === undefined ?
{fileLink === null ?
<p>Nincs fájl.</p> :
<a href={fileLink}>Fájl letöltése</a>}
<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.
Finish editing this message first!
Please register or to comment