Improved error handling on student page.
Build and Test App / Build-and-test-App (push) Successful in 33s
Details
Build and Test App / Build-and-test-App (push) Successful in 33s
Details
This commit is contained in:
parent
317e85ef35
commit
f8fa2023c8
|
@ -117,14 +117,15 @@ const sampleEntry: Ref<Entry | null> = ref({
|
|||
|
||||
<h4>Scores</h4>
|
||||
<p>
|
||||
Students' scores are calculated per week. The calculation is shown below:
|
||||
Scores are calculated using a <em>score expression</em>. This is just a mathematical formula with a few variables
|
||||
you can use. More information on what variables are available is show directly below the score expression editor.
|
||||
</p>
|
||||
<p>
|
||||
<code>phone_score * 0.3 + behavior_score * 0.7</code> where
|
||||
Also, you can choose the period of time over which to calculate scores. The following timeframes are currently
|
||||
available:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>phone_score = days_compliant / days_present</code></li>
|
||||
<li><code>behavior_score = (good_days * 1.0 + mediocre_days * 0.5) / days_present</code></li>
|
||||
<li>Weekly - Scores are calculated from Monday to Friday of each week.</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { ClassroomComplianceAPIClient, type Entry, type Student } from '@/api/classroom_compliance';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { onMounted, ref, type Ref } from 'vue';
|
||||
import { computed, onMounted, ref, type Ref } from 'vue';
|
||||
import StudentEntryItem from './StudentEntryItem.vue';
|
||||
import { APIError } from '@/api/base';
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
|
@ -11,22 +12,30 @@ const props = defineProps<{
|
|||
const authStore = useAuthStore()
|
||||
|
||||
const entries: Ref<Entry[]> = ref([])
|
||||
const loading: Ref<boolean> = ref(true)
|
||||
const noEntries = computed(() => !loading.value && entries.value.length === 0)
|
||||
|
||||
const apiClient = new ClassroomComplianceAPIClient(authStore)
|
||||
|
||||
onMounted(() => {
|
||||
apiClient.getStudentEntries(props.student.classId, props.student.id).handleErrorsWithAlert()
|
||||
apiClient.getStudentEntries(props.student.classId, props.student.id).result
|
||||
.then(result => {
|
||||
if (result !== null) {
|
||||
if (!(result instanceof APIError)) {
|
||||
entries.value = result
|
||||
} else {
|
||||
console.warn('Failed to get entries for student.', result.message)
|
||||
}
|
||||
})
|
||||
.finally(() => loading.value = false)
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="align-center">Entries</h3>
|
||||
<div>
|
||||
<p v-if="noEntries" class="align-center">
|
||||
This student doesn't have any entries yet.
|
||||
</p>
|
||||
<StudentEntryItem v-for="entry in entries" :key="entry.id" :entry="entry" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,7 @@ import { useAuthStore } from '@/stores/auth'
|
|||
import { onMounted, ref, useTemplateRef, type Ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import StudentEntriesList from './StudentEntriesList.vue'
|
||||
import { APIError } from '@/api/base'
|
||||
|
||||
const props = defineProps<{
|
||||
classId: string
|
||||
|
@ -40,8 +41,14 @@ onMounted(async () => {
|
|||
entries.value = values
|
||||
}
|
||||
})
|
||||
apiClient.getStudentStatisticsOverview(cls.value.id, student.value.id).handleErrorsWithAlert()
|
||||
.then(stats => statistics.value = stats)
|
||||
apiClient.getStudentStatisticsOverview(cls.value.id, student.value.id).result
|
||||
.then(result => {
|
||||
if (!(result instanceof APIError)) {
|
||||
statistics.value = result
|
||||
} else {
|
||||
console.warn('Failed to get student statistics: ', result.message)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
async function deleteThisStudent() {
|
||||
|
|
Loading…
Reference in New Issue