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