From e40e9bc1b3332fa2f7965d5bc6e2cf9042b173d2 Mon Sep 17 00:00:00 2001 From: Xurkon Date: Fri, 5 Jun 2026 21:06:08 -0500 Subject: [PATCH] fix: show selected learner data source mode --- .../Options/DatabaseTab/QuestieOptionsDatabase.lua | 14 ++++++++++++-- Tests/QuestieLearnerDataSourceMode_spec.lua | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Modules/Options/DatabaseTab/QuestieOptionsDatabase.lua b/Modules/Options/DatabaseTab/QuestieOptionsDatabase.lua index b0c8f8d..8ddda83 100644 --- a/Modules/Options/DatabaseTab/QuestieOptionsDatabase.lua +++ b/Modules/Options/DatabaseTab/QuestieOptionsDatabase.lua @@ -71,6 +71,10 @@ local function GetLearnerRuntimeMode() return (Questie.dbLearner.global and Questie.dbLearner.global.settings and Questie.dbLearner.global.settings.dataSourceMode) or "auto" end +local function GetLearnerSelectedMode() + return (Questie.dbLearner.global and Questie.dbLearner.global.settings and Questie.dbLearner.global.settings.dataSourceMode) or "auto" +end + local function IsLearnerRuntimeEnabled() local QuestieLearner = QuestieLoader:ImportModule("QuestieLearner") if QuestieLearner and QuestieLearner.IsEnabled then @@ -255,14 +259,20 @@ function QuestieOptions.tabs.database:Initialize() type = "select", order = 2.06, name = function() return l10n("Data Source Mode") end, - desc = function() return l10n("Choose whether Questie should display learner data, static database data, both, or neither. Learner recording can stay enabled independently.") end, + desc = function() + local runtimeMode = GetLearnerRuntimeMode() + if runtimeMode == "learner" and GetLearnerSelectedMode() ~= "learner" then + return l10n("Choose whether Questie should display learner data, static database data, both, or neither. Learner recording can stay enabled independently. The runtime may still force learner if the static DB is unavailable.") + end + return l10n("Choose whether Questie should display learner data, static database data, both, or neither. Learner recording can stay enabled independently.") + end, values = { auto = l10n("Auto (current behavior)"), learner = l10n("Learner Only"), static = l10n("Static Only"), none = l10n("Neither (base DB only)"), }, - get = function() return GetLearnerRuntimeMode() end, + get = function() return GetLearnerSelectedMode() end, set = function(_, v) if Questie.dbLearner.global and Questie.dbLearner.global.settings then Questie.dbLearner.global.settings.dataSourceMode = v diff --git a/Tests/QuestieLearnerDataSourceMode_spec.lua b/Tests/QuestieLearnerDataSourceMode_spec.lua index 11c9b58..a5f9ab2 100644 --- a/Tests/QuestieLearnerDataSourceMode_spec.lua +++ b/Tests/QuestieLearnerDataSourceMode_spec.lua @@ -17,6 +17,8 @@ describe("QuestieLearner data source mode", function() assert.is_true(has(dbOptions, "learner = l10n(\"Learner Only\")")) assert.is_true(has(dbOptions, "static = l10n(\"Static Only\")")) assert.is_true(has(dbOptions, "none = l10n(\"Neither (base DB only)\")")) + assert.is_true(has(dbOptions, "local function GetLearnerSelectedMode()")) + assert.is_true(has(dbOptions, "get = function() return GetLearnerSelectedMode() end")) end) it("defaults the learner mode to auto and exposes the live refresh hook", function()