fix: show selected learner data source mode
This commit is contained in:
@@ -71,6 +71,10 @@ local function GetLearnerRuntimeMode()
|
|||||||
return (Questie.dbLearner.global and Questie.dbLearner.global.settings and Questie.dbLearner.global.settings.dataSourceMode) or "auto"
|
return (Questie.dbLearner.global and Questie.dbLearner.global.settings and Questie.dbLearner.global.settings.dataSourceMode) or "auto"
|
||||||
end
|
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 function IsLearnerRuntimeEnabled()
|
||||||
local QuestieLearner = QuestieLoader:ImportModule("QuestieLearner")
|
local QuestieLearner = QuestieLoader:ImportModule("QuestieLearner")
|
||||||
if QuestieLearner and QuestieLearner.IsEnabled then
|
if QuestieLearner and QuestieLearner.IsEnabled then
|
||||||
@@ -255,14 +259,20 @@ function QuestieOptions.tabs.database:Initialize()
|
|||||||
type = "select",
|
type = "select",
|
||||||
order = 2.06,
|
order = 2.06,
|
||||||
name = function() return l10n("Data Source Mode") end,
|
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 = {
|
values = {
|
||||||
auto = l10n("Auto (current behavior)"),
|
auto = l10n("Auto (current behavior)"),
|
||||||
learner = l10n("Learner Only"),
|
learner = l10n("Learner Only"),
|
||||||
static = l10n("Static Only"),
|
static = l10n("Static Only"),
|
||||||
none = l10n("Neither (base DB only)"),
|
none = l10n("Neither (base DB only)"),
|
||||||
},
|
},
|
||||||
get = function() return GetLearnerRuntimeMode() end,
|
get = function() return GetLearnerSelectedMode() end,
|
||||||
set = function(_, v)
|
set = function(_, v)
|
||||||
if Questie.dbLearner.global and Questie.dbLearner.global.settings then
|
if Questie.dbLearner.global and Questie.dbLearner.global.settings then
|
||||||
Questie.dbLearner.global.settings.dataSourceMode = v
|
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, "learner = l10n(\"Learner Only\")"))
|
||||||
assert.is_true(has(dbOptions, "static = l10n(\"Static 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, "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)
|
end)
|
||||||
|
|
||||||
it("defaults the learner mode to auto and exposes the live refresh hook", function()
|
it("defaults the learner mode to auto and exposes the live refresh hook", function()
|
||||||
|
|||||||
Reference in New Issue
Block a user