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,7 +90,10 @@ 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 -->
|
||||
|
|
@ -125,6 +127,8 @@ const assignment = computed(
|
|||
</div>
|
||||
</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,6 +205,9 @@ const endBadgeText = computed(() => {
|
|||
</script>
|
||||
|
||||
<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 class="flex">
|
||||
<LearningContentMultiLayout
|
||||
|
|
@ -266,4 +267,6 @@ const endBadgeText = computed(() => {
|
|||
</div>
|
||||
</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