Merge pull request #2168 from raizasafeel/fix/persona

fix(persona): redirection route and skip button
This commit is contained in:
Jannat Patel
2026-03-06 17:44:42 +05:30
committed by GitHub
3 changed files with 27 additions and 24 deletions

View File

@@ -187,26 +187,6 @@ const setCategories = (data) => {
}
}
const isPersonaCaptured = async () => {
let persona = await call('frappe.client.get_single_value', {
doctype: 'LMS Settings',
field: 'persona_captured',
})
return persona
}
const identifyUserPersona = async () => {
if (user.data?.is_system_manager && !user.data?.developer_mode) {
let personaCaptured = await isPersonaCaptured()
if (personaCaptured) return
if (!courseCount.value) {
router.push({
name: 'PersonaForm',
})
}
}
}
const getCourseCount = () => {
if (!user.data) return
if (!user.data.is_moderator) return
@@ -214,7 +194,6 @@ const getCourseCount = () => {
doctype: 'LMS Course',
}).then((data) => {
courseCount.value = data
identifyUserPersona()
})
}

View File

@@ -40,12 +40,14 @@
import { computed, inject, onMounted, ref } from 'vue'
import { call, createResource, usePageMeta } from 'frappe-ui'
import { sessionStore } from '@/stores/session'
import { useRouter } from 'vue-router'
import StudentHome from '@/pages/Home/StudentHome.vue'
import AdminHome from '@/pages/Home/AdminHome.vue'
import Streak from '@/pages/Home/Streak.vue'
const user = inject<any>('$user')
const { brand } = sessionStore()
const router = useRouter()
const evalCount = ref(0)
const currentTab = ref<'student' | 'instructor'>('student')
const showStreakModal = ref(false)
@@ -71,7 +73,29 @@ const isAdmin = computed(() => {
)
})
const isPersonaCaptured = async () => {
let persona = await call('frappe.client.get_single_value', {
doctype: 'LMS Settings',
field: 'persona_captured',
})
return persona
}
const identifyUserPersona = async () => {
if (user.data?.is_system_manager && !user.data?.developer_mode) {
let personaCaptured = await isPersonaCaptured()
if (personaCaptured) return
let courseCount = await call('frappe.client.get_count', {
doctype: 'LMS Course',
})
if (!courseCount) {
router.push({ name: 'PersonaForm' })
}
}
}
onMounted(() => {
identifyUserPersona()
if (isAdmin.value) {
currentTab.value = 'instructor'
} else {

View File

@@ -79,7 +79,7 @@ const submitPersona = () => {
responses: JSON.stringify(responses),
}).then(() => {
router.push({
name: 'Courses',
name: 'Home',
})
})
}
@@ -87,12 +87,12 @@ const submitPersona = () => {
const skipPersonaForm = () => {
call('frappe.client.set_value', {
doctype: 'LMS Settings',
name: null,
name: 'LMS Settings',
fieldname: 'persona_captured',
value: 1,
}).then(() => {
router.push({
name: 'Courses',
name: 'Home',
})
})
}