Skip to content

Commit

Permalink
Fixed upload mark button and added it to task mark table component to…
Browse files Browse the repository at this point in the history
… allow for batch uploading
  • Loading branch information
DomiVesalius committed Aug 18, 2023
1 parent c639e35 commit 8299a5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/Module/Mark/TaskMarkTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import DashboardCard from '../../FlexyMainComponents/base-card/DashboardCard';
import SaveIcon from '@mui/icons-material/Save';
import InstructorApi from '../../../api/instructor_api';
import GetMarkCSVButton from './GetMarkCSVButton';
import UploadMarksButton from "./UploadMarks/UploadMarksButton";

function extractMarkData(data) {
return Object.keys(data).map((studentName) => {
Expand Down Expand Up @@ -182,6 +183,7 @@ const TaskMarkTable = ({ courseId, taskId }) => {
<DashboardCard title={`Marks for ${taskId}`}>
<Stack spacing={2}>
<GetMarkCSVButton task={taskId} course_id={courseId} />
<UploadMarksButton courseId={courseId} taskId={taskId}/>
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }}>
<TableHead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
import { Button } from '@mui/material';
import Grid from '@mui/material';
import { Form } from 'react-router-dom';
import {Button, Grid} from '@mui/material';
import StaffApi from '../../../../api/staff_api';
import { toast } from 'react-toastify';
import UploadFileIcon from "@mui/icons-material/UploadFile";
import {Form} from "formik";

const UploadMarksButton = (courseId, taskId) => {
const UploadMarksButton = ({ courseId, taskId }) => {
const [file, setFile] = useState(null);

const handleUpload = (event) => {
Expand All @@ -22,14 +22,10 @@ const UploadMarksButton = (courseId, taskId) => {
};

return (
<Grid>
<Form>
<Button>
Upload Marks
<input hidden accept="*.csv" type="file" onChange={handleUpload} />
</Button>
</Form>
</Grid>
<Button component="label" startIcon={<UploadFileIcon />} variant="contained" color="secondary">
Upload Marks
<input hidden accept="*.csv" type="file" onChange={handleUpload} />
</Button>
);
};

Expand Down

0 comments on commit 8299a5c

Please sign in to comment.