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,7 +90,10 @@ 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-content flex">
|
||||||
<div class="h-full w-1/2 overflow-y-auto bg-white">
|
<div class="h-full w-1/2 overflow-y-auto bg-white">
|
||||||
<!-- Left part content goes here -->
|
<!-- Left part content goes here -->
|
||||||
|
|
@ -125,6 +127,8 @@ const assignment = computed(
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>Could not load all data</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,6 +205,9 @@ const endBadgeText = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<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 v-if="assignment && assignmentCompletion">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<LearningContentMultiLayout
|
<LearningContentMultiLayout
|
||||||
|
|
@ -266,4 +267,6 @@ const endBadgeText = computed(() => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>Could not load all data</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