Skip to content

Commit

Permalink
Merge branch 'release-0.5.0' into release-0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-jaeger committed Oct 28, 2024
2 parents b7ba070 + 7ee3d03 commit 3dfd649
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 41 deletions.
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ dependencies:
- git
- pip:
- grader-service==0.3.0
- grader-labextension==0.5.4
- grader-labextension==0.5.5
- traitlets==5.9.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grader-labextension",
"version": "0.5.4",
"version": "0.5.5",
"description": "Grader Labextension is a JupyterLab extension to enable automatic grading of assignment notebooks.",
"keywords": [
"jupyter",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test = [
]

[tool.tbump.version]
current = "0.5.4"
current = "0.5.5"

regex = '''
(?P<major>\d+)
Expand Down
3 changes: 2 additions & 1 deletion src/components/coursemanage/files/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ export const Files = ({ lecture, assignment, onAssignmentChange }: IFilesProps)

const handlePushAssignment = async (commitMessage: string, selectedFiles: string[]) => {
try {
// Note: has to be in this order (release -> source)
await pushAssignment(lecture.id, assignment.id, 'release', commitMessage, selectedFiles);
await pushAssignment(lecture.id, assignment.id, 'source', commitMessage, selectedFiles);
queryClient.invalidateQueries({ queryKey: ['assignments', lecture.id] });
await queryClient.invalidateQueries({ queryKey: ['assignments'] });
enqueueSnackbar('Successfully Pushed Assignment', { variant: 'success' });
refetchRepoStatus();
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/coursemanage/grading/manual-grading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ export const ManualGrading = () => {
enqueueSnackbar('Generating feedback for submission!', {
variant: 'success'
});
queryClient.invalidateQueries({ queryKey: ['submissionsAssignmentStudent']});
reload();
await queryClient.invalidateQueries({ queryKey: ['submissionsAssignmentStudent']});
await reload();
} catch (err) {
console.error(err);
enqueueSnackbar('Error Generating Feedback', {
Expand Down
15 changes: 9 additions & 6 deletions src/components/coursemanage/grading/table-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ export function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
.then(response => {
enqueueSnackbar(
'Successfully matched ' +
response.syncable_users +
' submissions with learning platform',
response.syncable_users +
' submissions with learning platform',
{ variant: 'success' }
);
enqueueSnackbar(
'Successfully synced latest submissions with feedback of ' +
response.synced_user +
' users',
response.synced_user +
' users',
{ variant: 'success' }
);
})
Expand Down Expand Up @@ -187,7 +187,9 @@ export function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
enqueueSnackbar(`Generating feedback for ${numSelected} submissions!`, {
variant: 'success'
});
queryClient.invalidateQueries({ queryKey: ['submissionsAssignmentStudent']});
await queryClient.invalidateQueries({
queryKey: ['submissionsAssignmentStudent']
});
} catch (err) {
console.error(err);
enqueueSnackbar('Error Generating Feedback', {
Expand Down Expand Up @@ -302,7 +304,8 @@ export function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
</Tooltip>
<Tooltip
title={
checkAutogradeStatus() ? 'Generate feedback for all selected submissions'
checkAutogradeStatus()
? 'Generate feedback for all selected submissions'
: 'All selected submissions have to be automatically graded!'
}
>
Expand Down
42 changes: 20 additions & 22 deletions src/components/coursemanage/lecture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ import {
import * as React from 'react';
import { Assignment } from '../../model/assignment';
import { Lecture } from '../../model/lecture';
import { deleteAssignment, getAllAssignments } from '../../services/assignments.service';
import {
deleteAssignment,
getAllAssignments
} from '../../services/assignments.service';
import { CreateDialog, EditLectureDialog } from '../util/dialog';
import { getLecture, updateLecture } from '../../services/lectures.service';
import { red, grey } from '@mui/material/colors';
import { enqueueSnackbar } from 'notistack';
import {
useNavigate,
useNavigation,
useRouteLoaderData
} from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { ButtonTr, GraderTable } from '../util/table';
import { DeadlineComponent } from '../util/deadline';
import CloseIcon from '@mui/icons-material/Close';
Expand Down Expand Up @@ -163,10 +162,14 @@ export const LectureComponent = () => {
enabled: !!lectureId
});

const { data: assignments = [], isLoading: isLoadingAssignments, refetch: refetchAssignments } = useQuery<AssignmentDetail[]>({
const {
data: assignments = [],
isLoading: isLoadingAssignments,
refetch: refetchAssignments
} = useQuery<AssignmentDetail[]>({
queryKey: ['assignments', lecture, lectureId],
queryFn: () => getAllAssignments(lectureId),
enabled: !!lecture
enabled: !!lecture
});

React.useEffect(() => {
Expand All @@ -175,12 +178,10 @@ export const LectureComponent = () => {
}
}, [assignments]);


const [lectureState, setLecture] = React.useState(lecture);
const [assignmentsState, setAssignments] = React.useState<Assignment[]>([]);
const [isEditDialogOpen, setEditDialogOpen] = React.useState(false);


if (isLoadingLecture || isLoadingAssignments) {
return (
<div>
Expand All @@ -195,19 +196,20 @@ export const LectureComponent = () => {
setEditDialogOpen(true);
};


const handleUpdateLecture = (updatedLecture) => {
const handleUpdateLecture = updatedLecture => {
updateLecture(updatedLecture).then(
async (response) => {
async response => {
await updateMenus(true);
setLecture(response);
// Invalidate query key "lectures" and "completedLectures", so that we trigger refetch on lectures table and correct lecture name is shown in the table!
queryClient.invalidateQueries({ queryKey: ['lectures'] });
queryClient.invalidateQueries({ queryKey: ['completedLectures'] });
await queryClient.invalidateQueries({ queryKey: ['lectures'] });
await queryClient.invalidateQueries({
queryKey: ['completedLectures']
});
},
(error) => {
error => {
enqueueSnackbar(error.message, {
variant: 'error',
variant: 'error'
});
}
);
Expand Down Expand Up @@ -236,11 +238,7 @@ export const LectureComponent = () => {
alignItems="center"
sx={{ mt: 2, mb: 1 }}
>
<Stack
direction="row"
alignItems="center"
sx={{ mr: 2}}
>
<Stack direction="row" alignItems="center" sx={{ mr: 2 }}>
{lecture.code === lecture.name ? (
<Alert severity="info">
The name of the lecture is identical to the lecture code. You
Expand Down
2 changes: 1 addition & 1 deletion src/components/coursemanage/overview/assignment-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const AssignmentStatus = (props: IAssignmentStatusProps) => {
try {
await updateStatusMutation.mutateAsync(status);
await refetchAssignment();
queryClient.invalidateQueries({ queryKey: ['assignments', props.lecture.id] });
await queryClient.invalidateQueries({ queryKey: ['assignments'] });
enqueueSnackbar(success, { variant: 'success' });
} catch (err) {
enqueueSnackbar(error, { variant: 'error' });
Expand Down
12 changes: 7 additions & 5 deletions src/components/coursemanage/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { updateMenus } from '../../../menu';
import { extractIdsFromBreadcrumbs } from '../../util/breadcrumbs';
import { getLecture } from '../../../services/lectures.service';
import { useQuery } from '@tanstack/react-query';
import { queryClient } from '../../../widgets/assignmentmanage';

const gradingBehaviourHelp = `Specifies the behaviour when a students submits an assignment.\n
No Automatic Grading: No action is taken on submit.\n
Expand Down Expand Up @@ -70,14 +71,14 @@ export const SettingsComponent = () => {

const { data: lecture } = useQuery<Lecture>({
queryKey: ['lecture', lectureId],
queryFn: () => getLecture(lectureId),
enabled: !!lectureId,
queryFn: () => getLecture(lectureId),
enabled: !!lectureId
});

const { data: assignment } = useQuery<Assignment>({
queryKey: ['assignment', assignmentId],
queryFn: () => getAssignment(lectureId, assignmentId),
enabled: !!lecture && !!assignmentId,
queryFn: () => getAssignment(lectureId, assignmentId),
enabled: !!lecture && !!assignmentId
});

const [checked, setChecked] = React.useState(assignment.due_date !== null);
Expand Down Expand Up @@ -146,7 +147,7 @@ export const SettingsComponent = () => {
}
}
}
if (nErrors == 0) {
if (nErrors === 0) {
// error object has to be empty, otherwise submit is blocked
return {};
}
Expand All @@ -173,6 +174,7 @@ export const SettingsComponent = () => {
updateAssignment(lecture.id, updatedAssignment).then(
async response => {
await updateMenus(true);
await queryClient.invalidateQueries({ queryKey: ['assignments'] });
enqueueSnackbar('Successfully Updated Assignment', {
variant: 'success'
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/util/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export const CreateDialog = (props: ICreateDialogProps) => {
async a => {
await updateMenus(true);
props.handleSubmit(a);
await queryClient.invalidateQueries({ queryKey: ['assignments'] });
},

error => {
Expand All @@ -290,7 +291,6 @@ export const CreateDialog = (props: ICreateDialogProps) => {
});
}
);
queryClient.invalidateQueries({ queryKey: ['assignments', props.lecture.id] });
setOpen(false);
}
});
Expand Down

0 comments on commit 3dfd649

Please sign in to comment.