CODEX - Added modal colours for the Bells
This commit is contained in:
@@ -10,7 +10,10 @@ def get_melody_settings() -> MelodySettings:
|
||||
db = get_db()
|
||||
doc = db.collection(COLLECTION).document(DOC_ID).get()
|
||||
if doc.exists:
|
||||
return MelodySettings(**doc.to_dict())
|
||||
settings = MelodySettings(**doc.to_dict())
|
||||
# Backfill newly introduced defaults into stored settings.
|
||||
db.collection(COLLECTION).document(DOC_ID).set(settings.model_dump())
|
||||
return settings
|
||||
# Create with defaults
|
||||
defaults = MelodySettings()
|
||||
db.collection(COLLECTION).document(DOC_ID).set(defaults.model_dump())
|
||||
@@ -35,5 +38,6 @@ def update_melody_settings(data: MelodySettingsUpdate) -> MelodySettings:
|
||||
if "duration_values" in existing:
|
||||
existing["duration_values"] = sorted(existing["duration_values"])
|
||||
|
||||
doc_ref.set(existing)
|
||||
return MelodySettings(**existing)
|
||||
normalized = MelodySettings(**existing)
|
||||
doc_ref.set(normalized.model_dump())
|
||||
return normalized
|
||||
|
||||
Reference in New Issue
Block a user