Skip to content

Commit

Permalink
feat: assignment grading
Browse files Browse the repository at this point in the history
  • Loading branch information
pateljannat committed Dec 26, 2024
1 parent 85f8506 commit 7f768e8
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 210 deletions.
18 changes: 17 additions & 1 deletion frontend/src/components/Assessments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<div v-if="column.key == 'assessment_type'">
{{ row[column.key] == 'LMS Quiz' ? 'Quiz' : 'Assignment' }}
</div>
<div v-else-if="column.key == 'status'">
<Badge :theme="getStatusTheme(row[column.key])">
{{ row[column.key] }}
</Badge>
</div>
<div v-else>
{{ row[column.key] }}
</div>
Expand Down Expand Up @@ -83,6 +88,7 @@ import {
ListSelectBanner,
createResource,
Button,
Badge,
} from 'frappe-ui'
import { inject, ref } from 'vue'
import AssessmentModal from '@/components/Modals/AssessmentModal.vue'
Expand Down Expand Up @@ -180,7 +186,7 @@ const getAssessmentColumns = () => {
{
label: 'Assessment',
key: 'title',
width: '30rem',
width: '25rem',
},
{
label: 'Type',
Expand All @@ -199,4 +205,14 @@ const getAssessmentColumns = () => {
}
return columns
}
const getStatusTheme = (status) => {
if (status === 'Pass') {
return 'green'
} else if (status === 'Not Graded') {
return 'orange'
} else {
return 'red'
}
}
</script>
27 changes: 21 additions & 6 deletions frontend/src/components/Controls/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<slot name="item-label" v-bind="{ active, selected, option }" />
</template>

<template v-if="attrs.onCreate" #footer="{ value, close }">
<div>
<template #footer="{ value, close }">
<div v-if="attrs.onCreate">
<Button
variant="ghost"
class="w-full !justify-start"
Expand All @@ -42,6 +42,18 @@
</template>
</Button>
</div>
<div>
<Button
variant="ghost"
class="w-full !justify-start"
:label="__('Clear')"
@click="() => clearValue(close)"
>
<template #prefix>
<X class="h-4 w-4 stroke-1.5" />
</template>
</Button>
</div>
</template>
</Autocomplete>
<p v-if="description" class="text-sm text-gray-600">{{ description }}</p>
Expand All @@ -52,7 +64,7 @@
import Autocomplete from '@/components/Controls/Autocomplete.vue'
import { watchDebounced } from '@vueuse/core'
import { createResource, Button } from 'frappe-ui'
import { Plus } from 'lucide-vue-next'
import { Plus, X } from 'lucide-vue-next'
import { useAttrs, computed, ref } from 'vue'
const props = defineProps({
Expand All @@ -75,9 +87,7 @@ const props = defineProps({
})
const emit = defineEmits(['update:modelValue', 'change'])
const attrs = useAttrs()
const valuePropPassed = computed(() => 'value' in attrs)
const value = computed({
Expand Down Expand Up @@ -131,7 +141,7 @@ const options = createResource({
},
})
function reload(val) {
const reload = (val) => {
options.update({
params: {
txt: val,
Expand All @@ -142,6 +152,11 @@ function reload(val) {
options.reload()
}
const clearValue = (close) => {
emit(valuePropPassed.value ? 'change' : 'update:modelValue', '')
close()
}
const labelClasses = computed(() => {
return [
{
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/AssignmentForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-if="assignment.doc?.name"
:to="{
name: 'AssignmentSubmissionList',
params: {
query: {
assignmentID: assignment.doc.name,
},
}"
Expand Down
Loading

0 comments on commit 7f768e8

Please sign in to comment.