Improve error handling a bit...
This commit is contained in:
parent
c97ec9b399
commit
76e53a205c
|
|
@ -71,16 +71,15 @@ const assignment = computed(
|
|||
|
||||
<template>
|
||||
<div class="absolute bottom-0 top-0 z-10 w-full bg-white">
|
||||
<div
|
||||
v-if="assignment && assignmentCompletion && state.assignmentUser"
|
||||
class="relative"
|
||||
>
|
||||
<div v-if="queryResult.fetching.value"></div>
|
||||
<div v-else-if="queryResult.error.value">{{ queryResult.error.value }}</div>
|
||||
<div v-else>
|
||||
<header
|
||||
class="relative flex h-12 w-full items-center justify-between border-b border-b-gray-400 bg-white px-4 lg:h-16 lg:px-8"
|
||||
>
|
||||
<div class="flex items-center text-gray-900">
|
||||
<it-icon-assignment class="h-6 w-6"></it-icon-assignment>
|
||||
<div class="ml-2">Geleitete Fallarbeit: {{ assignment.title }}</div>
|
||||
<div class="ml-2">Geleitete Fallarbeit: {{ assignment?.title }}</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -91,39 +90,44 @@ const assignment = computed(
|
|||
<it-icon-close></it-icon-close>
|
||||
</button>
|
||||
</header>
|
||||
<div
|
||||
v-if="assignment && assignmentCompletion && state.assignmentUser"
|
||||
class="relative"
|
||||
>
|
||||
<div class="h-content flex">
|
||||
<div class="h-full w-1/2 overflow-y-auto bg-white">
|
||||
<!-- Left part content goes here -->
|
||||
<div class="p-10" data-cy="student-submission">
|
||||
<h3>Ergebnisse</h3>
|
||||
|
||||
<div class="h-content flex">
|
||||
<div class="h-full w-1/2 overflow-y-auto bg-white">
|
||||
<!-- Left part content goes here -->
|
||||
<div class="p-10" data-cy="student-submission">
|
||||
<h3>Ergebnisse</h3>
|
||||
|
||||
<div class="my-6 flex items-center">
|
||||
<img
|
||||
:src="state.assignmentUser?.avatar_url"
|
||||
class="mr-4 h-11 w-11 rounded-full"
|
||||
/>
|
||||
<div class="font-bold">
|
||||
{{ state.assignmentUser?.first_name }}
|
||||
{{ state.assignmentUser?.last_name }}
|
||||
<div class="my-6 flex items-center">
|
||||
<img
|
||||
:src="state.assignmentUser?.avatar_url"
|
||||
class="mr-4 h-11 w-11 rounded-full"
|
||||
/>
|
||||
<div class="font-bold">
|
||||
{{ state.assignmentUser?.first_name }}
|
||||
{{ state.assignmentUser?.last_name }}
|
||||
</div>
|
||||
</div>
|
||||
<AssignmentSubmissionResponses
|
||||
:assignment="assignment"
|
||||
:assignment-completion-data="assignmentCompletion.completion_data"
|
||||
:allow-edit="false"
|
||||
></AssignmentSubmissionResponses>
|
||||
</div>
|
||||
<AssignmentSubmissionResponses
|
||||
</div>
|
||||
<div class="w-1/2 overflow-y-auto bg-gray-200">
|
||||
<EvaluationContainer
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:assignment-user="state.assignmentUser"
|
||||
:assignment="assignment"
|
||||
:assignment-completion-data="assignmentCompletion.completion_data"
|
||||
:allow-edit="false"
|
||||
></AssignmentSubmissionResponses>
|
||||
@close="close()"
|
||||
></EvaluationContainer>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-1/2 overflow-y-auto bg-gray-200">
|
||||
<EvaluationContainer
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:assignment-user="state.assignmentUser"
|
||||
:assignment="assignment"
|
||||
@close="close()"
|
||||
></EvaluationContainer>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>Could not load all data</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
async function startEvaluation() {
|
||||
log.debug("startEvaluation");
|
||||
if (props.assignmentCompletion.completion_status !== "EVALUATION_SUBMITTED") {
|
||||
// noinspection TypeScriptValidateTypes
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentUserId: props.assignmentUser.user_id.toString(),
|
||||
completionStatus: "EVALUATION_IN_PROGRESS",
|
||||
completionDataString: JSON.stringify({}),
|
||||
// next line used for urql
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
id: props.assignmentCompletion?.id,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
);
|
||||
|
||||
async function submitEvaluation() {
|
||||
// noinspection TypeScriptValidateTypes
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
|
|
@ -50,6 +49,7 @@ async function submitEvaluation() {
|
|||
completionDataString: JSON.stringify({}),
|
||||
evaluationGrade: grade.value ?? 1,
|
||||
evaluationPoints: userPoints.value,
|
||||
// next line used for urql
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
id: props.assignmentCompletion?.id,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
async function evaluateAssignmentCompletion(completionData: AssignmentCompletionData) {
|
||||
log.debug("evaluateAssignmentCompletion", completionData);
|
||||
|
||||
// noinspection TypeScriptValidateTypes
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ const onEditTask = (task: AssignmentTask) => {
|
|||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
// noinspection TypeScriptValidateTypes
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
|
||||
async function upsertAssignmentCompletion(completion_data: AssignmentCompletionData) {
|
||||
try {
|
||||
// noinspection TypeScriptValidateTypes
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignmentId.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ const props = defineProps<{
|
|||
learningContent: LearningContentAssignment;
|
||||
}>();
|
||||
|
||||
// noinspection TypeScriptValidateTypes TODO: because of IntelliJ
|
||||
const queryResult = useQuery({
|
||||
query: ASSIGNMENT_COMPLETION_QUERY,
|
||||
variables: {
|
||||
|
|
@ -87,7 +86,6 @@ onMounted(async () => {
|
|||
|
||||
// create initial `AssignmentCompletion` first, so that it exists and we don't
|
||||
// have reactivity problem accessing it.
|
||||
// noinspection TypeScriptValidateTypes
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.learningContent.content_assignment_id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
|
|
@ -207,63 +205,68 @@ const endBadgeText = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="assignment && assignmentCompletion">
|
||||
<div class="flex">
|
||||
<LearningContentMultiLayout
|
||||
:current-step="stepIndex"
|
||||
:sub-title="subTitle"
|
||||
:title="getTitle()"
|
||||
:learning-content="props.learningContent"
|
||||
:steps-count="numPages"
|
||||
:show-next-button="showNextButton && stepIndex !== 0"
|
||||
:show-exit-button="showExitButton"
|
||||
:show-start-button="showNextButton && stepIndex === 0"
|
||||
:show-previous-button="showPreviousButton"
|
||||
:base-url="props.learningContent.frontend_url"
|
||||
step-query-param="step"
|
||||
start-badge-text="Einleitung"
|
||||
:end-badge-text="endBadgeText"
|
||||
close-button-variant="close"
|
||||
@previous="handleBack()"
|
||||
@next="handleContinue()"
|
||||
>
|
||||
<div class="flex">
|
||||
<div>
|
||||
<AssignmentIntroductionView
|
||||
v-if="stepIndex === 0"
|
||||
:due-date="dueDate"
|
||||
:assignment="assignment"
|
||||
></AssignmentIntroductionView>
|
||||
<AssignmentTaskView
|
||||
v-else-if="currentTask"
|
||||
:task="currentTask"
|
||||
:assignment-id="props.learningContent.content_assignment_id"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:learning-content-id="props.learningContent.id"
|
||||
></AssignmentTaskView>
|
||||
<AssignmentSubmissionView
|
||||
v-else-if="assignmentType === 'CASEWORK' && stepIndex + 1 === numPages"
|
||||
:due-date="dueDate"
|
||||
:assignment="assignment"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:learning-content-id="props.learningContent.id"
|
||||
:course-session-id="courseSession.id"
|
||||
@edit-task="jumpToTask($event)"
|
||||
></AssignmentSubmissionView>
|
||||
<div v-if="queryResult.fetching.value"></div>
|
||||
<div v-else-if="queryResult.error.value">{{ queryResult.error.value }}</div>
|
||||
<div v-else>
|
||||
<div v-if="assignment && assignmentCompletion">
|
||||
<div class="flex">
|
||||
<LearningContentMultiLayout
|
||||
:current-step="stepIndex"
|
||||
:sub-title="subTitle"
|
||||
:title="getTitle()"
|
||||
:learning-content="props.learningContent"
|
||||
:steps-count="numPages"
|
||||
:show-next-button="showNextButton && stepIndex !== 0"
|
||||
:show-exit-button="showExitButton"
|
||||
:show-start-button="showNextButton && stepIndex === 0"
|
||||
:show-previous-button="showPreviousButton"
|
||||
:base-url="props.learningContent.frontend_url"
|
||||
step-query-param="step"
|
||||
start-badge-text="Einleitung"
|
||||
:end-badge-text="endBadgeText"
|
||||
close-button-variant="close"
|
||||
@previous="handleBack()"
|
||||
@next="handleContinue()"
|
||||
>
|
||||
<div class="flex">
|
||||
<div>
|
||||
<AssignmentIntroductionView
|
||||
v-if="stepIndex === 0"
|
||||
:due-date="dueDate"
|
||||
:assignment="assignment"
|
||||
></AssignmentIntroductionView>
|
||||
<AssignmentTaskView
|
||||
v-else-if="currentTask"
|
||||
:task="currentTask"
|
||||
:assignment-id="props.learningContent.content_assignment_id"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:learning-content-id="props.learningContent.id"
|
||||
></AssignmentTaskView>
|
||||
<AssignmentSubmissionView
|
||||
v-else-if="assignmentType === 'CASEWORK' && stepIndex + 1 === numPages"
|
||||
:due-date="dueDate"
|
||||
:assignment="assignment"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:learning-content-id="props.learningContent.id"
|
||||
:course-session-id="courseSession.id"
|
||||
@edit-task="jumpToTask($event)"
|
||||
></AssignmentSubmissionView>
|
||||
</div>
|
||||
</div>
|
||||
</LearningContentMultiLayout>
|
||||
<div
|
||||
v-if="assignmentCompletion?.completion_status === 'EVALUATION_SUBMITTED'"
|
||||
class="min-w-2/5 mr-4 bg-gray-200 px-6 py-6"
|
||||
>
|
||||
<EvaluationSummary
|
||||
:assignment-user="assignmentUser"
|
||||
:assignment="assignment"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:show-evaluation-user="true"
|
||||
></EvaluationSummary>
|
||||
</div>
|
||||
</LearningContentMultiLayout>
|
||||
<div
|
||||
v-if="assignmentCompletion?.completion_status === 'EVALUATION_SUBMITTED'"
|
||||
class="min-w-2/5 mr-4 bg-gray-200 px-6 py-6"
|
||||
>
|
||||
<EvaluationSummary
|
||||
:assignment-user="assignmentUser"
|
||||
:assignment="assignment"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:show-evaluation-user="true"
|
||||
></EvaluationSummary>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>Could not load all data</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ const changeViewType = (viewType: ViewType) => {
|
|||
class="p-6"
|
||||
:class="useMobileLayout ? 'bg-gray-200' : ''"
|
||||
>
|
||||
<LearningPathAppointmentsMock></LearningPathAppointmentsMock>
|
||||
<!--<LearningPathAppointmentsMock></LearningPathAppointmentsMock>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ def create_test_assignment_submitted_data(assignment, course_session, user):
|
|||
assignment_user=user,
|
||||
assignment=assignment,
|
||||
course_session=course_session,
|
||||
learning_content_page=assignment.learningcontentassignment_set.first(),
|
||||
completion_data={
|
||||
subtask["id"]: {
|
||||
"user_data": {"text": user_text},
|
||||
|
|
@ -194,6 +195,7 @@ def create_test_assignment_submitted_data(assignment, course_session, user):
|
|||
assignment_user=user,
|
||||
assignment=assignment,
|
||||
course_session=course_session,
|
||||
learning_content_page=assignment.learningcontentassignment_set.first(),
|
||||
completion_status=AssignmentCompletionStatus.SUBMITTED,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue