From 470123c77a14fff37eddc352a82a2adbbe62c5ac Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 22 Apr 2025 16:17:29 +0530 Subject: [PATCH] chore: fixed settings --- .github/workflows/ui-tests.yml | 1 + cypress.config.js | 2 +- cypress/e2e/course_creation.cy.js | 5 +--- frontend/src/components/Modals/Settings.vue | 4 +-- frontend/src/pages/Courses.vue | 5 ++++ .../doctype/lms_settings/lms_settings.json | 27 ++++++++++++++++--- lms/lms/utils.py | 4 +++ 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 5338837c..f4b87366 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -100,6 +100,7 @@ jobs: bench --site lms.test execute frappe.utils.install.complete_setup_wizard bench --site lms.test execute frappe.tests.ui_test_helpers.create_test_user bench --site lms.test set-password frappe@example.com admin + bench --site lms.test execute lms.lms.utils.persona_captured - name: cypress pre-requisites run: | diff --git a/cypress.config.js b/cypress.config.js index 5e1c68ea..c7c1354e 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -13,6 +13,6 @@ module.exports = defineConfig({ openMode: 0, }, e2e: { - baseUrl: "http://testui:8000", + baseUrl: "http://pertest:8000", }, }); diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index 061fabb7..28b97041 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -2,10 +2,7 @@ describe("Course Creation", () => { it("creates a new course", () => { cy.login(); cy.wait(1000); - cy.visit("/lms"); - cy.wait(1000); - cy.get("div").contains("Skip").click(); - cy.wait(1000); + cy.visit("/lms/courses"); // Create a course cy.get("button").contains("New").click(); diff --git a/frontend/src/components/Modals/Settings.vue b/frontend/src/components/Modals/Settings.vue index ab89d535..315d066f 100644 --- a/frontend/src/components/Modals/Settings.vue +++ b/frontend/src/components/Modals/Settings.vue @@ -322,11 +322,11 @@ const tabsStructure = computed(() => { icon: 'LogIn', fields: [ { - label: 'Identify User Persona', + label: 'Identify User Category', name: 'user_category', type: 'checkbox', description: - 'Enable this option to identify the user persona during signup.', + 'Enable this option to identify the user category during signup.', }, { label: 'Disable signup', diff --git a/frontend/src/pages/Courses.vue b/frontend/src/pages/Courses.vue index 61f514f5..58b4717a 100644 --- a/frontend/src/pages/Courses.vue +++ b/frontend/src/pages/Courses.vue @@ -172,6 +172,11 @@ const isPersonaCaptured = async () => { const identifyUserPersona = async () => { let personaCaptured = await isPersonaCaptured() + debugger + console.log('personaCaptured', personaCaptured) + console.log('user.data?.is_system_manager', user.data?.is_system_manager) + console.log('user.data?.developer_mode', user.data?.developer_mode) + if ( user.data?.is_system_manager && !user.data?.developer_mode && diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index 597fee53..8bf72de4 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -61,7 +61,10 @@ "column_break_uwsp", "payment_reminder_template", "seo_tab", - "meta_description" + "meta_description", + "meta_image", + "column_break_xijv", + "meta_keywords" ], "fields": [ { @@ -106,7 +109,7 @@ "default": "0", "fieldname": "user_category", "fieldtype": "Check", - "label": "Identify User Persona" + "label": "Identify User Category" }, { "default": "0", @@ -372,6 +375,22 @@ "fieldtype": "Small Text", "label": "Meta Description" }, + { + "description": "This image will be shown on lists and pages that don't have an image by default", + "fieldname": "meta_image", + "fieldtype": "Attach Image", + "label": "Meta Image" + }, + { + "fieldname": "column_break_xijv", + "fieldtype": "Column Break" + }, + { + "description": "Common keywords that will be used for all pages", + "fieldname": "meta_keywords", + "fieldtype": "Small Text", + "label": "Meta Keywords" + }, { "default": "0", "fieldname": "persona_captured", @@ -384,8 +403,8 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-04-22 14:34:19.656896", - "modified_by": "Administrator", + "modified": "2025-04-22 16:05:27.914422", + "modified_by": "sayali@frappe.io", "module": "LMS", "name": "LMS Settings", "owner": "Administrator", diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 9a39b4a9..83e219ec 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -2167,3 +2167,7 @@ def get_palette(full_name): hash_name = hashlib.md5(encoded_name).hexdigest() idx = cint((int(hash_name[4:6], 16) + 1) / 5.33) return palette[idx % 8] + + +def persona_captured(): + frappe.db.set_single_value("LMS Settings", "persona_captured", 1)