fix: show selected learner data source mode

This commit is contained in:
Xurkon
2026-06-05 21:06:08 -05:00
parent 15023b4a3a
commit e40e9bc1b3
2 changed files with 14 additions and 2 deletions
@@ -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
@@ -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()