From cee962c0e0f8d3c41f7ab4fcef4e39988c35b57c Mon Sep 17 00:00:00 2001 From: Trey T Date: Sun, 17 May 2026 13:06:07 -0500 Subject: [PATCH] =?UTF-8?q?Vocab=20Flashcards=20=E2=80=94=20make=20session?= =?UTF-8?q?=20size=20configurable=20in=20Settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VocabVerbPool.sessionCardLimit was hardcoded at 20. Settings now has a "Vocab Flashcards → Cards per session" picker (10 / 15 / 20 / 25 / 30 / 50 / All) backed by the vocabSessionCardLimit @AppStorage key. VocabVerbPool.sessionCardLimit became a computed property reading that key (0/unset → default 20; 999 → "All"). Applies to both Quiz and Learn modes since they share the same session pool. Co-Authored-By: Claude Opus 4.7 (1M context) --- Conjuga/Conjuga/Services/VocabSessionQueue.swift | 10 +++++++--- .../Conjuga/Views/Settings/SettingsView.swift | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Conjuga/Conjuga/Services/VocabSessionQueue.swift b/Conjuga/Conjuga/Services/VocabSessionQueue.swift index f73ecb9..a5ca85d 100644 --- a/Conjuga/Conjuga/Services/VocabSessionQueue.swift +++ b/Conjuga/Conjuga/Services/VocabSessionQueue.swift @@ -116,9 +116,13 @@ struct VocabSessionQueue { /// sitting is bounded — proper SRS behaviour rather than a 100+ card slog. enum VocabVerbPool { - /// Maximum verbs in one session. Overdue cards are pulled first, then new - /// (never-reviewed) verbs fill the rest. - static let sessionCardLimit = 20 + /// Maximum verbs in one session, from the "Cards per session" setting + /// (`vocabSessionCardLimit`). Defaults to 20 when unset; 999 means "All". + /// Overdue cards are pulled first, then new (never-reviewed) verbs. + static var sessionCardLimit: Int { + let stored = UserDefaults.standard.integer(forKey: "vocabSessionCardLimit") + return stored == 0 ? 20 : stored + } static func sessionVerbs( localContext: ModelContext, diff --git a/Conjuga/Conjuga/Views/Settings/SettingsView.swift b/Conjuga/Conjuga/Views/Settings/SettingsView.swift index 057e342..e2a8ea8 100644 --- a/Conjuga/Conjuga/Views/Settings/SettingsView.swift +++ b/Conjuga/Conjuga/Views/Settings/SettingsView.swift @@ -10,6 +10,10 @@ struct SettingsView: View { @State private var showVosotros: Bool = true @State private var autoFillStem: Bool = false + /// Cards per vocab-practice session. 999 = "All" (no cap). + @AppStorage("vocabSessionCardLimit") private var vocabSessionCardLimit: Int = 20 + private let vocabSessionSizes: [Int] = [10, 15, 20, 25, 30, 50, 999] + private let levels = VerbLevel.allCases private let irregularCategories: [IrregularSpan.SpanCategory] = [ .spelling, .stemChange, .uniqueIrregular @@ -42,6 +46,18 @@ struct SettingsView: View { } } + Section { + Picker("Cards per session", selection: $vocabSessionCardLimit) { + ForEach(vocabSessionSizes, id: \.self) { size in + Text(size == 999 ? "All" : "\(size)").tag(size) + } + } + } header: { + Text("Vocab Flashcards") + } footer: { + Text("How many verbs a Vocab Flashcards session draws. Overdue verbs are pulled first, then new ones.") + } + Section { ForEach(levels, id: \.self) { level in Toggle(level.displayName, isOn: Binding(