about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-19T17·56+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-19T18·02+0100
commit541c40cd2f0524cfa4c70c531c0ed6e7803ffda2 (patch)
tree13394e2bc7e0fee0be94cc66916429393266d526 /website/sandbox/learnpianochords
parenta059c32403b2baa8298fef39ce39ff3324e65944 (diff)
Ensure only whitelisted chord inversions present in initial state
Whoops...
Diffstat (limited to 'website/sandbox/learnpianochords')
-rw-r--r--website/sandbox/learnpianochords/src/State.elm8
1 files changed, 6 insertions, 2 deletions
diff --git a/website/sandbox/learnpianochords/src/State.elm b/website/sandbox/learnpianochords/src/State.elm
index 3b9d29c34443..764c8b2564fd 100644
--- a/website/sandbox/learnpianochords/src/State.elm
+++ b/website/sandbox/learnpianochords/src/State.elm
@@ -63,7 +63,9 @@ init =
             [ { pitchClass = Theory.C, mode = Theory.MajorMode } ]
     in
     { whitelistedChords =
-        keys |> List.concatMap Theory.chordsForKey
+        keys
+            |> List.concatMap Theory.chordsForKey
+            |> List.filter (\chord -> List.member chord.chordInversion inversions)
     , whitelistedChordTypes = chordTypes
     , whitelistedInversions = inversions
     , whitelistedPitchClasses = pitchClasses
@@ -200,7 +202,9 @@ update msg model =
             ( { model
                 | whitelistedKeys = keys
                 , whitelistedChords =
-                    keys |> List.concatMap Theory.chordsForKey
+                    keys
+                        |> List.concatMap Theory.chordsForKey
+                        |> List.filter (\chord -> List.member chord.chordInversion model.whitelistedInversions)
                 , selectedChord = Nothing
               }
             , Cmd.none