Skip to content

Commit

Permalink
Merge branch 'release-0.6.0' of github.com:TU-Wien-dataLAB/Grader-Lab…
Browse files Browse the repository at this point in the history
…extension into release-0.6.0
  • Loading branch information
florian-jaeger committed Oct 28, 2024
2 parents c521939 + 0ade5bd commit b7ba070
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
21 changes: 12 additions & 9 deletions src/components/assignment/assignment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const AssignmentComponent = () => {
} = useQuery<number>({
queryKey: ['subLeft'],
queryFn: async () => {
refetchSubmissions();
await refetchSubmissions();
const response = await getSubmissionCount(lectureId, assignmentId);
const remainingSubmissions =
assignment.max_submissions - response.submission_count;
Expand Down Expand Up @@ -150,9 +150,11 @@ export const AssignmentComponent = () => {
...gb.getNotebooks().map(n => n + '.ipynb'),
...gb.getExtraFiles()
]);
const active_step = calculateActiveStep(submissions);
setActiveStatus(active_step);
});
}
}, [lecture, assignment]);
}, [lecture, assignment, submissions]);

if (
isLoadingAssignment ||
Expand Down Expand Up @@ -188,7 +190,7 @@ export const AssignmentComponent = () => {
enqueueSnackbar('Successfully Reset Assignment', {
variant: 'success'
});
refetchFiles();
await refetchFiles();
} catch (e) {
if (e instanceof Error) {
enqueueSnackbar('Error Reset Assignment: ' + e.message, {
Expand All @@ -212,9 +214,10 @@ export const AssignmentComponent = () => {
async () => {
await submitAssignment(lecture, assignment, true).then(
() => {
refetchSubleft();
const active_step = calculateActiveStep(submissions);
setActiveStatus(active_step);
refetchSubleft().then(() => {
const active_step = calculateActiveStep(submissions);
setActiveStatus(active_step);
});
enqueueSnackbar('Successfully Submitted Assignment', {
variant: 'success'
});
Expand Down Expand Up @@ -278,8 +281,8 @@ export const AssignmentComponent = () => {
{ period: 'P0D', scaling: undefined }
];
// no late_submission entry found
if (late_submission.length == 0) {
return false
if (late_submission.length === 0) {
return false;
}

const late = moment(assignment.due_date)
Expand Down Expand Up @@ -455,7 +458,7 @@ export const AssignmentComponent = () => {
lecture={lecture}
assignment={assignment}
submissions={submissions}
subLeft = {subLeft}
subLeft={subLeft}
sx={{ m: 2, mt: 1 }}
/>
</Box>
Expand Down
7 changes: 4 additions & 3 deletions src/components/assignment/submission-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export const SubmissionList = (props: ISubmissionListProps) => {
startIcon={<DeleteIcon />}
size="small"
onClick={() => {
const warningMessage = props.subLeft === 0 && props.submissions.length === 1
const warningMessage =
props.subLeft === 0 && props.submissions.length === 1
? '<strong>This is your last submission left. If you delete it, you won’t be able to submit again and you will be graded with 0 points.<strong></strong>'
: '';
showDialog(
Expand All @@ -146,10 +147,10 @@ export const SubmissionList = (props: ISubmissionListProps) => {
props.assignment.id,
value.id
);
queryClient.invalidateQueries({
await queryClient.invalidateQueries({
queryKey: ['submissions']
});
queryClient.invalidateQueries({
await queryClient.invalidateQueries({
queryKey: ['submissionsAssignmentStudent']
});
enqueueSnackbar('Successfully Deleted Submission', {
Expand Down

0 comments on commit b7ba070

Please sign in to comment.